Developer forum

Forum » CMS - Standard features » Indexing product groups for Type-ahead search searching.

Indexing product groups for Type-ahead search searching.

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

we have a prospect where the client wants a type-ahead search, showing list of product groups. Is that possible with a productindexbuilder, and is it just as straightforward as making a product type-ahead search? So that we can use a query to show relevant productgroup results - or do I have to use facets for this?

/Hans


Replies

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

bump

 

 
Nicolai Pedersen
Reply

The product index builder indexes only products, so groups will only exist in that index on product documents where a couple of fields contains information about groups.

You basically have 2 ways you can have groups in the type ahead. 

  1. Groups where the name of the group is matching the search term. I.e. searching "bike" will give the groups "Mountain bikes" and "Road bikes"
  2. Groups where at least one product is in the group has the product matches the search term. I.e. searcing for "chain" will give you the groups "mountain bikes", "Road biked" and "Chain rings" because all of those groups have products that matches the search term.

You can do both using the product index by adding a facet and adding the groupnames to the search string.

In option 1 you filter out facet options that does not partially match your search term i.e. "mountain bike".contains("bike") => option.contains(searchString)

In option 2 you just list all groups from the facet.

You need the field with groups 2 times - one field where the group names are analyzed for searching and one field where the group names are not analyzed for the facet.

BR Nicolai

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Perfect,  thank you Nicolai 👍🏻

/Hans

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi again

I have been trying to get it to work all morning, but no luck.

I want the facet to only show options where the productname contains search term.

What type of facet should i use, and what render type should i use? And how can i set the facet to only select groups from certain parent groups?

I tried with all types, of facets - but it gives the same result. My facet is setup as the image below

And my query is like this

 

My querypublisher page is configured like this

But i get way too many results. Is there something else I have to configure, or am i totally off?

/Hans

 

You must be logged in to post in the forum