addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1light-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [NYC-Apache-Lucene-Solr-Meetup] Solr Dynamic Facets

From: Ali O.
Sent on: Monday, June 4, 2012 2:58 PM
Creation of facets should be related your application's requirements. Solr don't know what you are trying to accomplish. In general you need 5-10 facets for a standard web application. Imagine an e-commerce site, if you provide 70 facets to end user it will get complicated for them. You can have 70 facets but you may want to show them in a workflow I guess. If you are using Solr for a BI application I can understand why you may need 70 facets. Anyway, I don't know your requirements.

If you don't want to specify facet fields or queries in your query requests,  you can define them in your solrconfig.xml.
 <requestHandler name="search" class="solr.SearchHandler" default="true">
    <lst name="invariants">
         <str name="facet">true</str>
         <str name="facet.mincount">1</str>
          <str name="facet.field">category</str>
         <str name="facet.query">price:[* TO 500]</str>
         <str name="facet.query">price:[500 TO *]</str>

If you have 70 facets,define them in invariants section. You should enable facet=true and set facet.mincount=1 in order to eliminate facets with count 0. Be careful about invariants section because  "invariants" are a way of letting Solr lock down the options available to Solr clients.  For example with the configuration above you will always get facet result even if you disable faceting in your query request.  For more info see

Faceting will definitely impact query performance.  Solr creates filter cache for facet results and it uses this cache for future queries. You can utilize filter cache to improve faceting performance. Other factors that are related to performance are # unique terms in a field, and faceting method. Faceting is not suggested on tokenized fields and fields with too many unique values.

For more info you can check


On Mon, Jun 4, 2012 at 12:56 PM, Sudarshan Kadambi <[address removed]> wrote:
Hi Guys,

How do people deal with the lack of Solr support for Dynamic Facets? What I mean by that is, you need to tell Solr what facets to produce rather than Solr figuring that out for you. 

This JIRA is still unresolved:

My current thought is that I'd ask Solr to produce all possible facets (I've over 70) and then discard the ones where the top facet value has a count of 0. What are the performance implications of this?

On a related note, I haven't been able to figure out how is it that Solr does faceted search? Is it just a straightforward iterate over each document in the result set and increment the facet counts for each facet requested? 


Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Sudarshan Kadambi ([address removed]) from NYC Apache Lucene/Solr Meetup.
To learn more about Sudarshan Kadambi, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy