Configuring Settings for WP Search with Algolia

When you create an index in your Algolia Search dashboard, it has a dedicated configuration panel to dictate and control how the index behaves when a search is performed. However, a WordPress website powered by WP Search with Algolia may have one too many indexes created for it.

The plugin will create an index that is used for what we call “searchable posts,” dedicated to settings used on the “Search Page.” Individual indexes are also created for each content type you enable with Autocomplete, except “all posts,” which re-uses the index for “searchable posts.” In this blog post, we’ll cover configuring settings for WP Search with Algolia and a few best practices.

Configuring Settings via Algolia.com

If you are not using WP Search with Algolia, you must sign in to Algolia directly to manage your index configurations. The APP_ID and INDEX_NAME portions are unique to your own installation. Here, you will configure relevance essentials and optimizations, filtering and faceting, pagination and display details, and, lastly, search behavior.

Configuring When Using the WP Search with Algolia Plugin

This is an audio board.When your WordPress install is powered by the WP Search with Algolia plugin, you technically have multiple methods to manage your index settings. This can be potentially confusing.

Have you seen those “Push Settings” buttons in WP Search with Algolia’s settings pages? They deploy and push settings to your Algolia Dashboard right from your WordPress dashboard.

The “Search Page” has one button dedicated to the “searchable posts” index. Meanwhile, each index from the Autocomplete settings has its own “Push Settings” button.

The question at this point is, “What settings are you referring to?” From a functional standpoint, the settings in WP Search with Algolia are used to enable index types and create the indexes, especially once re-indexing has occurred. However, the re-index process does not push any settings that affect the “Configuration” panel for the given index in Algolia.com dashboard.

Configuring Index Settings

If you have followed any of our tutorials or copied some example code from the wiki, like our Index Settings page, you have locally configured how the given index should behave. Something that isn’t the most obvious is that saving a function callback and add_filter( '...' ) line of code isn’t going to register the settings with your Algolia Dashboard automatically.

This is where the “Push Settings” buttons come into play. Once you press any of those buttons, WP Search with Algolia will take a set of Algolia default values and run them through our filters. Your callbacks can customize the values before pushing the entire setup to your Algolia.com Dashboard.

Any values not overwritten by the WordPress filters should end up still matching the defaults, while the overwritten values will be newly customized and reflected in Algolia.com

Configuring Index Settings in Algolia Dashboard vs the WP Search with Algolia Plugin

Here’s where it may get tricky and produce potentially unexpected results. If you’ve customized some settings for your index directly in the Algolia.com dashboard but have not also added code to reflect those same settings, then the “Push Settings” button will actually overwrite those.

The information flow is not “pull the current state from Algolia.com, perform a merge, and push back up to Algolia.com.” The “Push Settings” will only push defaults and code-altered values.

What’s the Best Practice for Index Settings?

This is an airplane dashboard.When it comes down to it, the best option is to pick one location or the other to manage settings. If you want to manage all of your indices from the Algolia.com dashboard and those configuration panels, ignore the “Push Settings” buttons in the WordPress dashboard.

However, an argument must be made for managing your index settings via code. When managed solely via the Algolia.com dashboard (while there’s the ability to duplicate indexes), having configuration set via code makes it really easy to deploy all your configured settings at the push of a button.

This is extremely handy when working with multiple environments, like a development copy, and keeping multiple developers in sync if you are working with a team that all has local copies of the site.

Having configurations in code also makes version control ready. Perhaps you want to try some different configurations to see how things perform. Switching branches in your version control system and easily returning to previous settings saves a lot of time. It also helps make sure you didn’t forget how something was previously configured.

There is a way for both the Algolia dashboard and code to mix. If you want to tinker and experiment with your results’ relevance really quickly, you could use the Algolia.com dashboard to try things out and then commit the final decisions to your code, ready for others or other environments to utilize.

When managing index settings via code, the biggest thing to remember is that whenever you change the configuration, you must push the appropriate “Push settings” button to push the current local config to the index. Saving the configuration setting changes to your code files does not push them to Algolia. Using the “Push Settings” buttons will handle that push to the intended Algolia indexes.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.