0
votes

I am not sure if this can be done with solr. But this is what I am doing for an online store search functionality. The main search box is a dismax parser for multiple fields :

 qf: description^1.0 color^1.0 name^1.0 size^1.0

Equal weight across multiple fields for now. Further I create a facet on some of these fields ex: color, size. The client has a request that when they search using a particular keyword and it matches any of the faceted fields the filter appear selected in the front end. So if the user searches for 'red' The color facet for red should appear selected.

Since solr is searching across multiple fields I don't think this is possible or is it?

1

1 Answers

1
votes

It is not about Solr. First, This requirement is flawed at user experience level. Traditionally facets (also known as guided navigators) are used to filter search results. Just having "red" across multiple fields does not mean all the products appeared are colr "red" . When you have "red" selected in Co filter you are visually telling user that all products in search results are "red". If that is not the case do not do it.

It that is the case, then ideal situation is, when the user enters "red" , you should first check user input against colr facets (preferably against cacheed list) and then add that color as filter to query as fq=colr:red parameter so that it is "true" filter and is part of your search query. This can be done against all known displayed facets (colr,size etc.) very quickly and activate them automatically if there is a match. Used right, that would actually make a cool feature.