search mobile facets autocomplete spellcheck crawler rankings weights synonyms analytics engage api customize documentation install setup technology content domains user history info home business cart chart contact email activate analyticsalt analytics autocomplete cart contact content crawling custom documentation domains email engage faceted history info install mobile person querybuilder search setup spellcheck synonyms weights engage_search_term engage_related_content engage_next_results engage_personalized_results engage_recent_results success add arrow-down arrow-left arrow-right arrow-up caret-down caret-left caret-right caret-up check close content conversions-small conversions details edit grid help small-info error live magento minus move photo pin plus preview refresh search settings small-home stat subtract text trash unpin wordpress x alert case_deflection advanced-permissions keyword-detection predictive-ai sso

Site Search Wordpress Plugin Guide

Wordpress has search by default. You can add it to the sidebar, header, or footer, as a widget. The Site Search Wordpress Plugin replaces the default Wordpress search experience, providing a more robust and configurable search experience backed by Elasticsearch, the leading open source search Engine.

Plugin Setup

If you already have an active account, retrieve your API Key from the Site Search dashboard.

If you don’t, signup for a free 14 day trial and explore some of the features.

Login to Wordpress admin and click Plugins.

Click Add New, and search for the Site Search Plugin for WordPress plugin.

Once installed, Site Search will appear:

Wordpress - Retrieve the API Key from your dashboard, add it to Wordpress.
Adding the API Key to Wordpress

Place your API Key where requested, then click Authorize.

Empowered with your API Key, the plugin can now create things on your behalf.

The first thing it will create is a search engine, or Engine for short.

Provide a name for it, then select from one of 13 different languages:

Wordpress - Provide an Engine name, and choose a language. Universal is good for most cases.
Naming your Engine and choosing a language from Wordpress.

The plugin synchronizes with your Site Search account.

This means that all the content you have created will be indexed into your search engine.

Indexing transforms your content into documents which can be searched and analyzed with great speed.

Begin synchronization! Click Synchronize:

Wordpress - Synchronize posts.
Synchronizing posts automatically indexes your posts within Site Search

All adjustments to your content from this point will be synchronized automatically.

Add content, delete content, edit content, and it will be updated.

If you make the change in Wordpress, it will be reflected within Site Search.

That's it! Site Search now powers your Wordpress website search.

Feature Guides

Customize your search experience through powerful relevance features.

We have guides for each of them:

  • Weights: How much value each field has when searching. Should the title carry more weight than the description? That's a job for Weights.
  • Synonyms: Are they looking for "cars" or "automobiles"? Create synonyms sets to combine similar terms.
  • Result Rankings: Promote, hide, and re-ordered documents from your search results.
  • Analytics: Search data generates deep insights. Use those insights to perfect your search experience.

WordPress Posts Schema

Once synchronized, your posts become indexed "documents".

The documents adhere to an Engine schema -- this enables relevant search.

Think of a schema as the fields you have available for modification.

For the purposes of this tutorial, note that:

  1. string fields are used for autocomplete
  2. text fields are used for full-text search
Field Type Description
external_id enum A special field that stores the WordPress post ID
title string The post's title
author string The author's name.
tags string A list of the post's tags
body text The text of the post.
excerpt text The text of the post's excerpt
category enum The category ID number.
url enum The URL for to the post.
image enum The URL for the first image associated with the post.
timestamp date The publication date of the post.
object_type enum The type of post (for example "post", "page", or the name of a custom post type).
updated_at date The date when the post was last updated in Swiftype.

For a full overview of the different field types like string and enum, see the schema design guide.

WP-CLI Support

Swiftype Site Search plugin supports WP-CLI.

To see the available commands type wp swiftype in your WordPress install directory.

The CLI is useful if you have a large number of posts (more than 10,000).

Control the indexing batch size to synchronize posts with Site Search more quickly

The also CLI provides an option to destructively reindex the contents of your WordPress site, for large deletes or a fresh start.

To index your WordPress site with the CLI...

  1. Make sure you have WP-CLI installed.
  2. Configure the plugin with your API Key and create your Engine.

Then run:

wp swiftype sync

To index more content at once, increase the batch size:

wp swiftype sync --index-batch-size=100

In general, using a larger batch size will be faster.

There is a 100 document limit and a single batch may not exceed 10MB.

Stuck? Looking for help? Contact support or check out the Site Search community forum!