You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Xavier <xa...@audivox.fr> on 2012/03/07 12:40:52 UTC

Index all possible facets values even if there is no document in relation

Hi everyone,

My question is a little weird but i need to have all my facet values in solr
index :

I have a database with all possible values of my facets for my solr
documents.

I don't have all my facets values used by my documents, but I would like to
index theses facets values even if they returned 0 documents.

I need this for SEO management, and because i want to test this facets
values (with 0 documents) without requesting my database.


Best Regards,
Xavier

--
View this message in context: http://lucene.472066.n3.nabble.com/Index-all-possible-facets-values-even-if-there-is-no-document-in-relation-tp3806461p3806461.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Index all possible facets values even if there is no document in relation

Posted by Chris Hostetter <ho...@fucit.org>.
: I don't have all my facets values used by my documents, but I would like to
: index theses facets values even if they returned 0 documents.

field faceting builds the list of constraints based on the indexed values 
found in the field -- if you don't index it, it doesn't know about it.

if you want to have field facet constraints returned even though they 
aren't in any "real" docs, you need to index at least one "fake" doc 
containing all ofthose values ... then just make sure you exclude that doc 
at query time using an appended "fq" (you could do it by id, or some 
special field, whatever is easiest for you).  

as long as you use "facet.mincount=0" the values will still be retunred as 
constraints even if no documents in your results match them


-Hoss