Aurel
Aurel

Reputation: 423

Algolia doesn't retrieve facets exact_matches information in a suggestions index

I've implemented an index using the hosted Algolia platform. It contains some records all of them have a few facets, including "lang" that can have the value 'fr', 'de', 'en' or 'it'. I use this facet to filter my query when doing user searches on a website.

It seems to work fine as show here:

A record from the main index includes expected data and allow facet filtering

I built a suggestion index related to this main index to give auto complete suggestions to my users while they're typing. I followed this article: https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/query-suggestions/js/#query-suggestions-index-schema

As this index gets populated I'm expecting to retrieve facets information from the main index but somehow this information is empty:

This record from the suggestions index is missing facets hits

I would be expecting the following data so I could then use website_main_index.facets.exact_matches.lang.value as an attribute for facetting in the suggestion index to be able to filter my suggestions for language relevant results:

{
"website_main_index": {
  "exact_nb_hits": 6,
  "facets": {
    "exact_matches": {
      "lang": {
        "fr": 3,
        "en": 2,
        "de": 1,
      }
    },
    "analytics": {
      ...
    }
  }
}

I used to have this working in the past so I'm confident there's a way to do it. Maybe Algolia made some changes I'm not aware of, or more probably there's some configuration I missed.

I made sure that:

List of Attributes for faceting

I've tried a few times to delete / recreate this suggestion index and with variants of settings, without success.

Upvotes: 1

Views: 144

Answers (1)

Aurel
Aurel

Reputation: 423

The answer relies in the categories settings that should be properly set up, in the Query Suggestions main configuration page.

An issue with Algolia can happen when the after distinct setting is used, where the attributes listed by the system can show up with an extra parenthesis ()). Make sure you type the attribute name properly (without the parenthesis) and press the ADD button.

Categories settings in the algolia suggestion panel

Upvotes: 0

Related Questions