• Resolved ericmulder

    (@ericmulder)


    Hi,

    When using algolia as the backend search engine, I encountered the following bug. Although algolia gives the right (fuzzy) results back, they don’t show up. For example, if I search for ‘seearching a match’, algolia return the post_id (say id = 1) of ‘searching a match’, but then the WP_Query still executes something like SELECT bla WHERE post_title LIKE '%seearching a match%' and post_id IN (1) which return zero records.

    This is because the s parameter still gets added to the final WP_Query.

    A quick fix is to reset the ‘s’ parameter, but this breaks other functions like get_search_query()

    I reset the s parameter here:

    
    function labelvier_algolia_should_filter_query($should_filter, $query) {
    	if($should_filter) {
    		$query->set('s', null);
    	}
    	return $should_filter;
    }
    add_filter('algolia_should_filter_query', 'labelvier_algolia_should_filter_query', 10, 2);
    
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Typo searches bug when using Algolia as the backend search’ is closed to new replies.