Search result page not working

thanks for the an amazing theme. I have developed 5 themes now using root and all works like charm.

With this new theme, I am having trouble with the search result page. So the situation is like this.

I am modifying the root theme rather than creating a child theme.
All my templates reside in the usual templates folder.
For custom-post-type I have created separate base files for each custom post type e.g. for hotels custom post type i have base-hotels.php

I am trying to implement a search functionality. the search functionality works fine but rather than taking me to search.php which is in the theme root folder it output the search result in the custom post type page.
when I search any hotel it outputs the result in the single-hotels.php page rather than search.php page. same thing happens with other custom post type.

However if it is unable to find any result, it sends the request to search.php and display no result found.

So far what I understood is that it picks where the search result is located and display the search result in that custom post type template rather than using search.php

I want all search results to be directed to search.php for display.

Sorry in advance, if my explanation is confusing.

thanks - Deepak

I haven’t been able to replicate this. Are you using a function to select which base file to load?

Thanks Foxaii.
Yes, I am using function to look for post type and load respective base file.
I managed to do a work around but checking if search is called then load base-search file.

the only issue with my hack is that I have options in my custom search form for user to select which post type to search the keyword from.

In order to get form value in my function so that I can set post type I have to turnoff roots_nice_search_redirect in cleanup.php. If I dont do that I am unable to get checkbox value from my custom search form see function below:

custom form field:

<?php $query_types = get_query_var('post_type'); ?>
			<td class="pull-right">
				<input type="checkbox" name="post_type[]" value="post_type1" <?php if (in_array('post_type1', $query_types)) { echo 'checked="checked"'; } ?> /><label>post_type1</label>
				<input type="checkbox" name="post_type[]" value="post_type2" <?php if (in_array('post_type2', $query_types)) { echo 'checked="checked"'; } ?> /><label>post_type2</label>

setting post type based on search form options:

 function searchfilter( $query )
    	$myposttype = $_GET['post_type'];
    	if ( !is_admin() && $query->is_main_query() )
    		if ( $query->is_search )
    			if ( in_array( 'post_type1', $myposttype) && in_array( 'post_type2', $myposttype) )
    				$query->set( 'post_type', array( 'post_type1', 'post_type2' ) );
    			else if ( in_array('post_type1', $myposttype))
    				$query->set( 'post_type', array( 'post_type1' ) );
    			else if ( in_array('post_type2', $myposttype))
    				$query->set( 'post_type', array( 'post_type2' ) );
    	return $query;
    add_filter( 'pre_get_posts','searchfilter' );

now my issue exists in the result is that the result output is in paginated. So if user select to search with both post type I want to display result grouped in post type.

The way I would do this is by using posts_orderby and adding a custom MySQL statement. The alternative would be to go through multiple loops, one per post type.