lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Sokolov <msoko...@safaribooksonline.com>
Subject Re: facet.field counts when q includes field
Date Sun, 27 Apr 2014 23:23:50 GMT
On 4/27/14 7:02 PM, Michael Sokolov wrote:
> On 4/27/2014 6:30 PM, Trey Grainger wrote:
>>>> So my question basically is: which restrictions are applied to the 
>>>> docset
>> from which (field) facets are computed?
>>
>> Facets are generated based upon values found within the documents 
>> matching
>> your "q=" parameter and also all of your "fq=" parameters. Basically, if
>> you do an intersection of the docsets from all "q=" and "fq=" parameters
>> then you end up with the docset the facet calculations are based upon.
>>
>> When you say "if I add type=book, *no* documents match, but I get facet
>> counts: { chapter=4 }", I'm not exactly sure what you mean. If you are
>> adding "q=toto&type=book&facet=true&facet.field=type" then the 
>> problem is
>> that the "type=book" parameter doesn't do anything... it is not a valid
>> Solr parameter for filtering here. In this case, all 4 of your documents
>> matching the "q=toto" query are still being returned, which is why the
>> facet count for chapters is 4.
> In fact my query looks like:
>
> q=fulltext_t%3A%28toto%29+AND+dc_type_s%3A%28book%29+%2Bdirectory_b%3Afalse&start=0&rows=20&fl=uri%2Ctimestamp%2Cdirectory_b%2Csize_i%2Cmeta_ss%2Cmime_type_ss&facet.field=dc_type_s

>
>
> or without url encoding:
>
>  q=fulltext_t:(toto) AND dc_type_s:(book) (directory_b:false)
> facet.field=dc_type_s
>
> default operator is AND
>
>  ... so I don't think that the query is broken like you described?
>
> -Mike
OK the problem wasn't with the query, but while I tried to write out a 
clearer explanation, I found it -- an issue in a unit test too boring to 
describe.  Facets do seem to work like you said, and how they're 
documented, and as I assumed they did :)

Thanks, and sorry for the noise.

-Mike

Mime
View raw message