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 Raheel Hasan <ra...@gmail.com> on 2013/09/12 15:54:31 UTC

Facet counting empty as well.. how to prevent this?

Hi,

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>

(that is coming because the query results had 4 rows with no value in that
field whole facet counts are being called).

Rest all is working just fine....

-- 
Regards,
Raheel Hasan

Re: Facet counting empty as well.. how to prevent this?

Posted by Upayavira <uv...@odoko.co.uk>.
The simplest thing is to exclude empty values in the query: myfield:[*
TO *]

Upayavira

On Thu, Sep 12, 2013, at 03:50 PM, Raheel Hasan wrote:
> ok, so I got the idea... I will pull 7 fields instead and remove the
> empty
> one...
> 
> But there must be some setting that can be done in Facet configuration to
> ignore certain value if we want to....
> 
> 
> On Thu, Sep 12, 2013 at 7:44 PM, Shawn Heisey <so...@elyograg.org> wrote:
> 
> > 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
> >
> >
> 
> 
> -- 
> Regards,
> Raheel Hasan

Re: Facet counting empty as well.. how to prevent this?

Posted by Raheel Hasan <ra...@gmail.com>.
ok, so I got the idea... I will pull 7 fields instead and remove the empty
one...

But there must be some setting that can be done in Facet configuration to
ignore certain value if we want to....


On Thu, Sep 12, 2013 at 7:44 PM, Shawn Heisey <so...@elyograg.org> wrote:

> 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
>
>


-- 
Regards,
Raheel Hasan

Re: Facet counting empty as well.. how to prevent this?

Posted by Shawn Heisey <so...@elyograg.org>.
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