Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I retrieve all applicable facet fields for a Solr search

I'm trying to use Solr for faceted-seaarch on a website.

When a user fires off a search query, I query Solr and retrieve the search results which can then be displayed.

My question is - how do I find out which facet fields and terms are applicable to the search results?

To be clear - different categories of products have different facet fields and I want to find a way to bring back the most relevant facet fields for the search results that have been returned. I don't want to have to specify the fields - I'd like Solr to identify the relevant ones for me.

Thanks in advance!

like image 967
Paul Kerrison Avatar asked Sep 28 '11 15:09

Paul Kerrison


2 Answers

I would recommend looking over all of the Simple Facet Parameters on the Solr Wiki, especially the examples at the bottom as they will show you all of the possible ways that you can configure the faceting results for your queries.

If I am understanding your question correctly... by default faceting will only bring back facets/counts based on the documents in the result set. However to make those more relevant to the search, you should set the facet.mincount to something other than the default value of 0. eg. &facet.mincount=1. But, again please refer to the documentation on how this works and can be applied to your scenario.

like image 177
Paige Cook Avatar answered Sep 17 '22 10:09

Paige Cook


Im having the same problem.

What I eventually did was to query Solr for the top 50 hits for a given query and then collect the names of the properties set on those products. I then do another query with the facet fields set to the product properties I found first time around.

like image 37
user1247060 Avatar answered Sep 20 '22 10:09

user1247060