If you missed the first in this series, go check out Advanced Search for WordPress: Part 1.
In this second article, we’re going to scratch a little deeper at some of the advanced features of Ajax Pro Search. Before you go making any of these changes, I would recommend getting comfy with the basic features first.
Speed: Index Table Engine
Within Ajax Pro Search there is an option to toggle the search engine functionality to search based off of an index table. Enabling this feature makes searches faster by making calls to the WordPress database lighter and snappier. Using an index table to optimize search speed is pretty much a requirement if you need to account for the following:
Search Shortcode Content: Lots of themes come packed with shortcode options that enable users to build out fancy things like FAQ accordions, tabbed sections, etc. The issue with this, is that any content sitting inside of a shortcode is often not searchable. Often, that content is valuable. Using the Index Table makes that content searchable.
Search Custom Fields: This is going to be crucial if your site is highly custom, or eCommerce. Let’s suppose that your eCom site sells something niche, like artillery cannons. In that case, you might have a custom field for “barrel size” with options like 122mm, 130mm, and so on. Don’t you want that content to be searchable for someone that is perusing your site for a new cannon? The Index Table includes those fields in search queries.
Massive Database of Posts: Maybe you just have a huge amount of content and don’t want your search to take forever. That would certainly make the user experience troublesome. Especially for the guy who is angry enough to be shopping for cannons. Creating an Index Table makes the calls to the database much faster, returning results instantaneously.
As with anything, however, there are a few downsides to the Index Table. The Index Table consists of individual keywords that are connected with relational and relevancy data. Since your search will be running on this data, this means that it cannot validate surrounding keywords and thus searching for an exact phrase is a no-go. In addition, inner parts of words are of no use to searchers. For example, if you search for “elop” it will not return results for “development.” However, the beginning and ends of keywords do work, so in that same example, “dev” and “ment” would give you the desired results.
Creating the Index Table
Now the leg work. We need to create the Index Table before we hook up the search engine. Go to Index Table in the panel options and you should arrive at a screen showing this:
Do not just press the inviting green button. We need to configure the settings first:
General Options: Here you will choose what types of data are included into your Index Table. This includes things like fields, post types, tags, categories, custom taxonomy terms, custom fields, author names, etc.
Advanced Options: This section allows you to get detailed. Here you can modify settings to remove stop-words from the index, include shortcodes, and determine which blogs in a multi-site structure will be indexed.
Once you have a applied the settings required for your specific site, you can then click the shiny green button and generate your index table. At the end, you will be shown the number of keywords that were generated based on the configuration settings you applied.
Connect the Index to Search
The final step is to go into the general settings of your search form. Click “Sources” and toggle your search engine from “Regular” to “Index Table Engine” using the drop down. Save your settings and you are done.