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

Filter Solr suggestions in Hybris

Former Member
1,047

Hello, Is there a way to add an fq to a suggestion search? I have tried doing it in Solr UI but it does not take my conditions into consideration. I need to filter my results and suggestions by products market which is indexed in Solr. The text search works like a charm but suggestions don't. Thank you!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member

Did you try using the cfq parameter in solr ? It is used for context filtering. I have not used it myself. Play around a little with this and you may get what you are looking for. Below is the link to official solr documentation https://lucene.apache.org/solr/guide/6_6/suggester.html

Former Member
0 Kudos

, Yes you can add this. If I understand correctly make "products market" as facet . Add this list in filterquery in SearchQuery object using below code:

 public void beforeSearch(FacetSearchContext arg0) throws FacetSearchException {
         arg0.getSearchQuery().getFacetValues().addAll(new ArrayList<String>(Arrays.asList(new FacetValueField("productsMarket"))));
             value);
     }

By implementing existing interface FacetSearchListener. Hope this will help you.

Former Member

I think FacetSearchListener doesn't execute while autosuggestion (/suggest query)