This Documentation is for SearchWP Version 3

Available since: 1.4.1


View Parameters »

By default SearchWP takes multiple passes at the index if necessary. The first pass uses AND logic which checks for results that have all of the terms in the search query present. If nothing is found, SearchWP will then take another pass at the index using OR logic. AND logic is usually more restrictive (i.e. provides more relevant results) but there are times when the search terms are very common and even AND logic returns many results.

This hook allows you to define the threshold SearchWP uses to flag whether an AND logic pass returned too many results to be useful. If this threshold is breached, SearchWP will take a more aggressive pass at the index using AND logic in titles only (unless you have set zero weights for all titles).

Note: You can prevent this refinement from happening with the searchwp_refine_and_results hook.

By default SearchWP will shift into this more aggressive AND refinement if more than 300 results are returned. You can modify that number by adding something like the following to your theme’s functions.php:

// if over 100 results are returned from an AND logic pass
// refine the AND results by title
function my_searchwp_max_and_results( $number_of_results ) {
return 100;
add_filter( 'searchwp_max_and_results', 'my_searchwp_max_and_results' );
view raw gistfile1.php hosted with ❤ by GitHub


Parameter Type Description
$number_of_results Integer

The ceiling for an acceptable number of AND logic results before shifting to more aggressive AND logic

[wpforms id="3080"]