Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr Facetting - Showing First 10 results and Other

Tags:

search

solr

facet

I am implementing a solution in Solr where I have a lot of values in my facet.

As opposed to displaying a long list of values(facets) down the side of my page I want to display the top 10. And also have one for other.

For instance I would be faceting on Nationality.

So, I do not want to have a list of every nationality, Nor do I want a "see all" button.

What I require is the top 10 nationalitys and then "Other".

When a user clicks on other, it facets on this?

like image 512
Mark Avatar asked Nov 27 '09 12:11

Mark


1 Answers

This is quite easy in Solr.. All you need to do is add a

&facet.limit=10

e.g.

http://solrserver:8080/solr/select&version=2.2&q=solr&start=0&rows=0&indent=on&facet=on&facet.field= nationality&facet.limit=10

to your request and you should be able to limit the results.

For more information you can check out my blog post on faceting in solr:

http://www.craftyfella.com/2010/01/faceting-and-multifaceting-syntax-in.html

or the solr wiki here:

http://wiki.apache.org/solr/SimpleFacetParameters#facet.limit

like image 155
CraftyFella Avatar answered Sep 28 '22 11:09

CraftyFella