You want to make sure you’re only messing with the main query and not subsequent queries called from a plugin or in a template on the search page. In other words…
if( !is_admin() && $query->is_search ) {
should be
if( !is_admin() && $query->is_search && $query->is_main_query() ) {
See http://codex.wordpress.org/Function_Reference/is_main_query