Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

solr faceted search - how do I specify multiple fields on the Solr Query UI?

I'm a newbie to solr and tying my hands at solr. Can some one here please explain how to specify multiple facet fields for a given search.

I'm using the Solr Admin UI/ query ink and it allows me to specify only one field. I would however like to facet on multiple fields like region industry stock-exchange etc on my company search.

I have gone through the solr wiki and relevant doc links like the one below http://docs.lucidworks.com/display/solr/Query+Screen

but none of them seem to explain how to specify multiple fields. I want to build something like the usual Amazon/Walmart etc search ui that provides multiple facets and counts when trying to search for a product on my planned cmpany search page.

like image 259
Chetya Avatar asked Jun 13 '13 15:06

Chetya


1 Answers

You are looking for json.facet

It's available from solr 5(some advanced features are available from solr 6). Basically that means you can insert your facet search parameters via json to the url.

It looks like this(live example):

&facet=true&json.facet={"filed1":{"type":"terms","field":"filed1","limit":2000},"filed2":{"type":"terms","field":"filed2","limit":2000}}

There is also a shorter version:

&facet=true&json.facet={"field1":{"terms":"field1"},"field2":{"terms":"field2"}}

You can find more information here

like image 174
Stas Sorokin Avatar answered Oct 25 '22 16:10

Stas Sorokin