On 9/12/2013 7:54 AM, Raheel Hasan wrote:
> I got a small issue here, my facet settings are returning counts for empty
> "". I.e. when no the actual field was empty.
> 
> Here are the facet settings:
> 
> <str name="facet.sort">count</str>
> <str name="facet.limit">6</str>
> <str name="facet.mincount">1</str>
> <str name="facet.missing">false</str>
> 
> and this is the part of the result I dont want:
> <int name="">4</int>

The "facet.missing" parameter has to do with whether or not to display
counts for documents that have no value at all for that field.

Even though it might seem wrong, the empty string is a valid value, so
you can't fix this with faceting parameters.  If you don't want that to
be in your index, then you can add the LengthFilterFactory to your
analyzer to remove terms with a length less than 1.  You might also
check to see whether the field definition in your schema has a default
value set to the empty string.

If you are using DocValues (Solr 4.2 and later), then the indexed terms
aren't used for facets, and it won't matter what you do to your analysis
chain.  With DocValues, Solr basically uses a value equivalent to the
stored value.  To get rid of the empty string with DocValues, you'll
need to either change your indexing process so it doesn't send empty
strings, or use a custom UpdateProcessor to change the data before it
gets indexed.

Thanks,
Shawn

Reply via email to