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:
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:
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:
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:
string
fields are used for autocompletetext
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...
- Make sure you have WP-CLI installed.
- 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!