Skip to content

Frequently Asked Questions

Keith Frey edited this page Oct 20, 2020 · 8 revisions

Frequently Asked Questions

I have more records than I have posts, is that normal?

This is intentional and allows you to fully leverage the Algolia engine.

The plugin takes care of the splitting for you and makes sure that your articles are fully indexed regardless of their size. This means that even if your article is huge and you are searching for a word that is at the very bottom, you will have it as part of the suggested articles.

Is it possible to disable post splitting?

Yes, you can turn off post splitting by defining a constant in your WordPress wp-config.php file.

define( 'ALGOLIA_SPLIT_POSTS', false );

You will need to re-index the indices to see the change.

Can I customize the Autocomplete dropdown look & feel?

Yes. You can find some detailed explanations on this page.

I have created a custom API key, but it is not accepted as a Search-Only API key in the plugin settings.

Creating a dedicated search API key is a good practice. If you want to be able to use that newly generated API key as the Search-Only API key, you have to make sure it only has the search ACL privilege. For security reasons, Algolia will reject every any Search-Only API key that has additional privileges.

In addition, Algolia also requires that the provided search API key has the TTL set to 0.

Will this plugin be compatible with my WordPress theme?

Yes. Actually this plugin introduces 2 main user oriented features:

  • Native Search: Which overrides the default WordPress search with Algolia,
  • Autocomplete: Which provides the user with an 'as you type' instant search experience.

In the first case, this plugin hooks into the WordPress native search feature. As a result, this will not impact your template because we only act on the backend side of things.

In the second case, the plugin provides a dropdown menu that will be displayed underneath your search bar as you type. Default css rules are provided so that the look and feel is consistent across different themes.

My data is out of sync with Algolia

Sometimes your WordPress content gets out of sync with Algolia. For example, if you are changing your permalink templates, all of your URLs will change and Algolia will not know about it. Content can also get out of sync when you use filters to change settings or attributes to push to Algolia. In either case you can simply re-index your content.

Can I use one Algolia account for multiple WordPress sites?

Definitely! In the same fashion that WordPress lets you prefix all database tables, Algolia allows you to prefix each index. This can be configured on the Indexing section of the plugin.

Why doesn't my autocomplete dropdown show up?

  1. Check that the autocomplete feature is turned on on the Autocomplete page of the admin UI
  2. Check that you have selected at least one index to display and ensure those indices were created in Algolia

The indexing is slow, can I optimize the required time?

Yes, however it depends on your servers capacities and the number of plugins you have enabled. By default, the plugin only indexes 100 items per indexing process to ensure it doesn't reach PHP max execution time or memory limits.

Here is a way to increase the number of items indexed on each PHP indexing process:

<?php

add_filter( 'algolia_indexing_batch_size', function() {
    return 200;
} );

If indexing doesn't work after the change, it probably means you pushed the number too high.

Can I push my custom user attributes?

Yes. You can do so by using the algolia_user_record filter:

<?php

/**
 * @param array   $record
 * @param WP_User $user
 *
 * @return array
 */
function custom_user_record( array $record, WP_User $user ) {
    $record['custom_field'] = get_user_meta( $user->ID, 'custom_field', true );
    /* Add as many as you want. */

    return $record;
}

add_filter( 'algolia_user_record', 'custom_user_record', 10, 2 );

Can I use custom thumbnail sizes?

Yes. If the thumbnail size you are willing to display is medium, you can do:

<# if ( data.images.medium ) { #>
    <img class="suggestion-post-thumbnail" src="{{ data.images.medium.url }}" alt="{{ data.post_title }}">
<# } #>

The plugin does not push all thumbnail sizes by default to avoid huge record payloads. You now need to use a filter hook that allows you to specify the thumbnail sizes you want to push. i.e.

add_filter('algolia_post_images_sizes', function($sizes) {
    $sizes[] = 'medium';

    return $sizes;
});

My issue is not listed here, what to do?

If your problem is covered here, please submit an issue with the error details here: https://github.com/WebDevStudios/wp-search-with-algolia/issues

Clone this wiki locally