SearchWP is an advanced search plugin that greatly improves WP core search.

FacetWP includes built-in integration with SearchWP.

Why SearchWP?

By default, WP core search is very basic. It searches only titles and the content field for matches, and has no understanding of relevancy.

SearchWP returns relevant results. It’s also highly configurable, allowing you to search through custom fields, post data, taxonomies, eCommerce data, and even PDFs.

SearchWP also supports custom engines, essentially letting you create different searches to include subsets of data. This is super helpful when combined with search facets (so you can search specific fields).

SearchWP

Usage

When SearchWP is installed, your Search facets will have additional options under the “Search Engine” setting. Simply choose the desired SearchWP search engine from the dropdown.

Buy SearchWP

Removing the post limit

By default, FacetWP fetches a maximum of 200 results from SearchWP. To remove this limit, use the following code:

SearchWP 4.x

add_filter( 'searchwp\swp_query\args', function( $args ) {
    if ( isset( $args['facetwp'] ) ) {
        $args['posts_per_page'] = -1;
    }
    return $args;
} );

SearchWP 3.x

add_filter( 'searchwp_swp_query_args', function( $args ) {
    if ( isset( $args['facetwp'] ) ) {
        $args['posts_per_page'] = -1;
    }
    return $args;
} );

SearchWP limits

For large sites, keep in mind that SearchWP has a much lower maximum post limit than FacetWP itself because all the advanced features and extra calculations SearchWP is doing behind the scenes require more server resources.

SearchWP works best on a site with anywhere from a few posts to a few thousand. If your website has tens of thousands of posts or even hundreds of thousands, SearchWP does recommend not using it (see their FAQ).

Using SearchWP with WPML or Polylang

If you are using SearchWP together with WPML or Polylang, make sure to:

  1. Install the Multilingual add-on
  2. Install the appropriate SearchWP integration extension:

The above SearchWP extensions will limit search results to the active language of the page. Without them, there will be a disconnect between the facets, their counts and the post listing.

See also