Reputation: 105
I have a Database with Cars and i want to create filters to lets users search for them quicker. I've worked with Solr before but i've never used facets.
The filters should work like this:
If the user selects one it should end up like this:
What would be the best way to archive something like this with Solr. Would Facets be perfect for this? I did some research but i haven't found any documentation displaying this kind of feature. Is there a name for this kind of filtering? Thanks allot for your help.
Upvotes: 0
Views: 42
Reputation: 1953
Yes, using Solr facets you can achieve this.
Give field name to facets.field
Index your documents into Solr. you can refer some links as this to index your db data into Solr. after indexing, query along with facets component.
Example:
http://localhost:8983/solr/collection/select?indent=on&q=*:*&wt=json&facet=true&facet.field=cat
scroll down to see facets results as below.
"facet_fields":{
"cat":[
"book",17,
"electronics",12,
"paperback",6,
"currency",4,
"memory",3,
"connector",2,
"graphics card",2,
"hard drive",2,
"search",2,
Upvotes: 1