How is Additional Sections autocomplete supposed to work

Hi,
I’m trying to achive a autocomplete section that lists all product attribute values that match the entered text. In my case, producers, i.e. each product has an attribute producer, and when someone searches for a producer name, this should be shown in the section, and when you click on it, the relevant instant search page with the producer pre-facted should open. (imagin someone typing “B”, it would show Bentley and BMW, which you could click then)
I thought, this is exactly what “Additional Sections” is made for. So I added the attribute from the dropdown, gave a name and saved. However nohting is shown when searching for a producer.
For testing, I placed producer above pages (which is working fine). Categories is also working fine. In debug mode, I can now see that aa-dataset-1, which I think is supposed to be the attribute.phtml of the hit for producer is empty. aa-dataset-2 is pages content.

Instant search faceting for this attributes works just fine.

Where is the flay in my logic?

regards
Alex

Hello Alex,

it should work exactly how you described.
Did you reindex Additional section indexer after you set it to additional section?
Are your producers all indexed in Algolia? Can you check that?

Hi,
I did run reindexer. I don’t have a seperate index, though. These values are part of the product index, which looks fine to me.

The values should be indexed in separate index as it’s not ideal to search for those from the products index.
Would you mind diving in a code of AdditionalSections indexer and see why it’s not indexed?

Ok, with seperate index in mind things look different. Searching for producer is double tricky here, because those are as ID in the database and an observer translates them to strings before going to algolia (for products). When I search for 2 (a valid producer ID), I get a result in autocomplete. Will have to throw in a algolia_additional_section_items_before_index obersver obviously.

So, for testing, I tried another attribute which is straight forward: Material.
This results in an index dev_default_section_material created, which looks a bit broken: All entries consist of ID/Value pairs (fair enogh), but ID and value are actually values, e.g.
objectID:Polyester
value:Polyester
Anyway. When I now search for something that is also used by some products, e.g. Beton, autocomplete looks fine, shows a section called Material with an entry “Beton”. Fine. Clicking on that redirects me to:
/catalogsearch/result/?q=undefined&refinement_key=material
Which obviously shows nothing. I don’t see where the query for undefined comes from, and why the facet value is missing. When I select the Beton facet from my normal top level category catalog page, I get this URL:
garten-und-landschaftsbau.html?q=&idx=dev_default_products&p=0&dFR%5Bmaterial%5D%5B0%5D=Beton&is_v=1
Which is working just fine.

Any idea what is wrong here?

Hello Alex,

having pairs indexed as it is (ObjectID, value) with the same value is correct. That’s the expected structure of the index.
What is weird here is the undefined query in your URL. The URL should look like: domain/catalogsearch/result/?q=Beton&refinement_key=Material. Would you mind sharing with me your website where I could investigate?

Thanks!

Will send a PM with the URL