Skip to content

[00] Subset Search, User guide

Getting started

Install Subset Search, let the first index build, try a search in the Tester and read what your visitors search for.

Subset Search replaces WordPress’s own search with ranked results from an index of your content. Your theme’s search form and results page keep working as they are. This page takes you from install to your first ranked search.

There are no ads, upsell screens or admin notices. If something needs your attention, you’ll find it in Tools → Site Health.

Install

  1. Download the free Subset Search zip from subsetwp.com/download/search.
  2. In WordPress, go to Plugins → Add New → Upload Plugin, choose the zip and click Install Now.
  3. Click Activate.

Subset Search needs WordPress 6.5 or later and PHP 8.1 or later.

Let the first index build

Activating the plugin starts a full index of your posts in the background. It runs in small steps through WP-Cron, so it doesn’t time out on shared hosting. Open Subset → Search → Index to watch it: while the tab is open, the progress bar carries the index on too.

Searches go through the index from the start, so a post that isn’t indexed yet can’t be found. Let the first index finish before you judge the results. On a large site, wp subset search index --all builds it from the command line with a progress bar.

After that, the index keeps itself up to date. A post is indexed again when you save it, when its categories, tags or indexed custom fields change, and, if you index comments, when one of its comments is added or approved.

Try a search in the Tester

Open Subset → Search → Tester, type a search and click Test. The Tester shows:

  • the words it looked for, after stemming and stopwords, plus any phrases and synonyms;
  • which stage answered: every word, any word, or partial words;
  • how long the search took;
  • the top 20 results, each with its score split by where the words matched.

Tests aren’t logged, so you can try as many as you like. If a post you expected is missing or low down, its score breakdown usually tells you why. How searching works covers the settings that change the ranking.

The settings screen

Subset → Search has five tabs:

TabWhat it’s for
SearchHow a search matches and ranks: every word or any word, partial words, phrases, synonyms, field and post type weights, the results page and did-you-mean. Changes apply to the next search.
IndexWhat’s indexed: post types, media, private posts, taxonomies, custom fields, author, comments, shortcodes, the shortest word, accents and stopwords. Below the settings is the index’s status, its size next to your posts table’s, and Rebuild index.
SearchesWhat visitors searched for, how often, and which searches found nothing.
TesterTry a search and see why each result ranks where it does.
AboutThe plugin’s version, and the rest of the Subset plugins.

A change on the Index tab only reaches searches once the index is rebuilt. When you save one, the tab says This needs a reindex with a button to start it. Search keeps working from the existing index while the rebuild runs.

Read what visitors search for

Subset → Search → Searches lists searches grouped by what was typed, with how many results each found the last time, how often it was searched and when. It opens on No results when there are any, because those are the searches your site has no answer for.

  • Narrow it to today, the last 7 days or the last 30 days.
  • Top 20 lists the most searched queries.
  • Try it opens a search in the Tester.
  • Add synonym takes you to the synonyms field with the search filled in, so a search for “sofa” can find your “couch” posts.
  • Export CSV downloads the view you’re looking at, and Clear log empties it.

The log keeps what was searched, how many results it found, when, and whether it came from the search form, the REST API or the admin. It stores no IP address, user account or browser details. A search that looks like an email address or a card number is stored as a hash, and the tab shows it as hidden. Entries older than 30 days are deleted daily, and you can shorten that, or turn logging off, under Logging on the same tab.

Highlighted results

On your theme’s results page, each result’s excerpt is the part of the post that matched, with the matched words highlighted. They’re wrapped in a mark element with the class subset-search-hit, which your theme can restyle. Turn this off under Results page on the Search tab to keep your theme’s usual excerpt, and change the excerpt’s length there.

You can also highlight the matched words in result titles. That’s off by default, because some themes put the title inside a link’s attributes, where the highlight shows up as code. Check your results page after you turn it on.

When a search finds nothing, a line above the results offers a correction from the words on your site, such as “Did you mean booking?”, linked to that search. Raise Suggest below to offer one when a search finds a few results too.

Add a search form

Your theme’s search form, the core Search block and get_search_form() all go through Subset Search as they are. To search some post types only, add the Search form block instead. It has the same settings and styles as the core Search block, plus a Post types panel in the block settings. Leave every type unticked to search everything the site searches.

Watch Site Health

Subset Search adds these checks to Tools → Site Health:

  • The search index is current: whether more than 5% of the posts that should be indexed are missing or waiting to be indexed again, or a settings change needs a rebuild.
  • No other search plugin is active: while Relevanssi, SearchWP, ElasticPress, Jetpack Search or FacetWP’s search facet is active, Subset Search answers no searches, so two engines never search the same query. This check says which plugin it’s waiting on.
  • The site is a size Subset Search suits: Subset Search keeps its index in your WordPress database. Past about 200,000 indexed documents, a hosted search service such as ElasticPress or Algolia will search faster and keep the load off your database.

The Info tab lists the documents indexed, the index’s size, the database schema version and the last rebuild.

Multisite

Network activation sets up every site. Each site has its own index, settings and search log.

Removing the plugin

Deleting the plugin deletes the index, the settings and the search log. The index is rebuilt from your posts if you install the plugin again. To keep the settings and the log, add this to wp-config.php before you delete the plugin:

define( 'SUBSET_SEARCH_DELETE_DATA_ON_UNINSTALL', false );

Report bugs and request features at subset-feedback on GitHub (opens in a new tab). For anything else, email hello@subsetwp.com.