cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Customizing Autosuggestion In SearchBox to show Products in matching categories

Former Member
0 Likes
531

Hi Experts,

I have the following requirement:-

In the search box for autosuggestions system is showing products with matching attribute value of search term.

Apart from matching this search term I need to match the category name also and system should show all matching products in that category.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Likes

Thanks Saurabh.

The client has changed the requirement :-

What they are looking for is that the search term should be matched in product name/description and all relevant categories of matching products should be shown as autosuggestions.

Former Member
0 Likes

Dear SPS

Solr create tokens out of your search term, Tokens get created based on the data in the 'text' type fields. So if you categoryName field is of type text then solr create tokens out of this field as well.

Now if you search for a term solr returns you the documents in which there are tokens that match the search term. In layman language, higher the number of matches, higher is the ranking of documents and higher the document would appear in the search result.

just to let you know, one solr document gets converted into one product data that you show at the frontend.

You can test it by creating some sample data. Create a product with product name as "Black leather bag" Put it in a category called "Tommy Hilfigher".

run solr indexing, once the data is in solr, go to solr console (https://localhost:8983/solr) and do a text search for Tommy Hilfigher, you product with name "Black leather bag" should appear.

Read solr wiki on how to do text search on solr console

Hope this helps, Let me know if you need more information.