lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brendan Grainger <brendan.grain...@gmail.com>
Subject Re: Receiving unexpected Faceting results.
Date Wed, 05 Jun 2013 12:41:23 GMT
Hi Dotan,

I think all you need to do is add:

facet.mincount=1

i.e.

select?q=*:*&fq=tags:dotan-*&facet=true&facet.field=tags&
rows=0&facet.mincount=1

Note that you can do it per field as well:

select?q=*:*&fq=tags:dotan-*&facet=true&facet.field=tags&
rows=0&f.tags.facet.mincount=1

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




On Wed, Jun 5, 2013 at 8:27 AM, Dotan Cohen <dotancohen@gmail.com> wrote:

> Consider the following Solr query:
> select?q=*:*&fq=tags:dotan-*&facet=true&facet.field=tags&rows=0
>
> The 'tags' field is a multivalue field. I would expect the previous
> query to return only tags that begin with the string 'dotan-' such as:
> dotan-home
> dotan-work
> ...but not strings which do not begin with (or even contain) the
> string in question.
>
> However, I am getting these results:
> <lst name="discoapi_tags">
>     <int name="dotan-home">14</int>
>     <int name="dotan-work">13</int>
>     <int name="beer">0</int>
>     <int name="beatles">0</int>
> </lst>
>
> It _may_ be that the 'beer' and 'beatles' tags were once attached to
> the same documents as are attached the 'dotan-home' and/or
> 'dotan-work'. I've done a bit of experimenting on this Solr install,
> so I cannot be sure. However, considering that they are in fact 0
> results for those two, I would not expect them to show up at all, even
> if they ever were attached to (i.e. once a value in the multiValue
> field) any of the results that match the filter query.
>
> So, the questions are:
> 1) How can I check if ever the multiValue fields for a particular
> document (given its uniqueKey id) ever contains a specific value.
> Alternatively, how can I see all the values that the document ever had
> for the field. I don't expect this to actually be possible, but I ask
> if it is, i.e. by examining certain aspects of the Solr index with a
> text editor.
>
> 2) If those spurious results are appearing does that mean necessarily
> that those values for the multivalued field were in fact once in the
> multivalued field for documents matching the filter query? Thus, the
> answer to the previous question would be to simply run a query for the
> id of the document in question, and facet on the multivalued field
> with a large limit.
>
> 3) How to have Solr return only those faceting values for the field
> that in fact begin with 'dotan-', even if a document has other tags
> such as 'beatles'?
>
> 4) How to have Solr return only those faceting values which are larger
> than 0?
>
> Thank you!
>
> --
> Dotan Cohen
>
> http://gibberish.co.il
> http://what-is-what.com
>



-- 
Brendan Grainger
www.kuripai.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message