Adding a search engine to WordPress

When installed out of the box, self-hosted WordPress instances can search for content in posts and pages, but its not very good. The content is not “indexed” for efficient search. Most users will benefit from adding more powerful search engine. There are two ways to do this.

The simplest and cheapest way to add search is with a plugin such as Relevanssi. Relevanssi will index your content for search, and save the data in the MYSQL database. It will save this data in tables created just for search. This is much more efficient than searching the posts and pages directly. Relevanssi can be customized to produce almost any specific search results pages. Relevanssi can also index the contents of MS Office and PDF documents. This makes all the text in the documents searchable. It can return text snippets with the search terms highlighted in the search results view.

Relevanssi will double the size of the WordPress’ database. And, high traffic combined with lots of search queries can slow down your server, since the queries are handled by PHP. Supporting a search engine might require an upgrade on your hosting platform.

Enterprise level WordPress installs, or any site with high traffic and lots of content would benefit from a search engine that indexes content on a dedicated application, running on a different server. The system I’ve used is the amazing ElasticSearch. To use this system, you need to set up an account with an ElasticSearch (ES) provider. On your WP site you need to install the ElasticPress plugin. This will index your content and save it in your ES instance. This system is extraordinarily powerful. A large, high traffic new organization, or a law or medical corporation with thousands of PDF documents, would benefit from a dedicated, customized search engine like this. It can search a vast amount of data very fast. And because the search queries are performed on the ES server, no heavy load is carried by the WP server or database.