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 mrw <mi...@gmail.com> on 2011/01/11 20:06:46 UTC

Adding fq to query with mincount=0 causes unexpected 0-count facet values to be returned?

I've noticed that performing a query with facet.mincount=0 and no fq clauses
results in a response where only facets with non-zero counts are returned,
but adding in an fq clause (caused by a user selecting a non-zero-valued
facet value checkbox) actually causes a bunch of 0-count facet values
completely unrelated to the query to be returned.

Is adding the fq constraint actually widening the query before
facet.mincount gets applied?  

E.g., say a query with no fq constraint produces the following facet values:

ID
1234 (1)
1111 (15)
1010 (30)

Title
Red (11)
Green (15)
Blue (32)

but when the user selects Blue (32), and I add &fq=Color:Blue, Solr returns
the following:

ID
1 (0)
2 (0)
3 (0)
...
99 (0)
100 (0)

Color
Orange (0)
Teal (0)
Red (0)
Green (0)
Blue (32)


Notice how, before the fq clause is added, none of the 0-count facets are
returned, even though facet.mincount = 0, but afterward, a bunch of 0-count
facets are returned?


The context of my question is trying to solve a problem where the
application must display facet values with a count of zero as filtering
operations remove them from the result set.  That is, if Red (10) was
displayed after the initial query, but the user filters on Blue (32), then
we must still display Red (0) so the user can select it and widen the query.  
Initially, we were using mincount=1 and managing the missing facets entirely
within the application, but now I'm trying to see if we can use mincount=0
and maybe some other constraints to achieve the same behavior without a lot
of custom code in the application.

Thanks
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Adding-fq-to-query-with-mincount-0-causes-unexpected-0-count-facet-values-to-be-returned-tp2236105p2236105.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Adding fq to query with mincount=0 causes unexpected 0-count facet values to be returned?

Posted by mrw <mi...@gmail.com>.

mrw wrote:
> 
> 
> We're actually using the default facet.limit value of 100.  I will
> increase it to 200 and see if the non-zero-count facets show up.  Maybe
> that was causing my confusion.
> 

Yep -- the 0-count facets were not being returned due to the facet.limit
cutoff.    

So, unless there is another parameter that can be used with facet.mincount=0
in order to tune the results, it looks like I will need to use
facet.mincount=1 and handle the processing of omitted facets in the
application.

Thanks for the help.
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Adding-fq-to-query-with-mincount-0-causes-unexpected-0-count-facet-values-to-be-returned-tp2236105p2236801.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Adding fq to query with mincount=0 causes unexpected 0-count facet values to be returned?

Posted by mrw <mi...@gmail.com>.

iorixxx wrote:
> 
> 
> After re-reading, it is not normal that none of the 0-count facets are
> showing up. Can you give us full parameter list that you obtain this
> by adding &echoParams=all to your search URL?
> 
> May be you limit facets to three in your first query? What happens when
> you add &facet.limit=-1?
> 
> 

We're actually using the default facet.limit value of 100.  I will increase
it to 200 and see if the non-zero-count facets show up.  Maybe that was
causing my confusion.
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Adding-fq-to-query-with-mincount-0-causes-unexpected-0-count-facet-values-to-be-returned-tp2236105p2236768.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Adding fq to query with mincount=0 causes unexpected 0-count facet values to be returned?

Posted by Ahmet Arslan <io...@yahoo.com>.
> >> Notice how, before the fq clause is added, none of
> the
> >> 0-count facets are
> >> returned, even though facet.mincount = 0, but
> afterward, a
> >> bunch of 0-count
> >> facets are returned?
> >>
> > This is normal.
> 
> What's behind that?  Is it widening the results before
> the mincount
> constraint is being applied?

After re-reading, it is not normal that none of the 0-count facets are showing up. Can you give us full parameter list that you obtain this
by adding &echoParams=all to your search URL?

May be you limit facets to three in your first query? What happens when you add &facet.limit=-1?


      

Re: Adding fq to query with mincount=0 causes unexpected 0-count facet values to be returned?

Posted by mrw <mi...@gmail.com>.

>> Notice how, before the fq clause is added, none of the
>> 0-count facets are
>> returned, even though facet.mincount = 0, but afterward, a
>> bunch of 0-count
>> facets are returned?
>>
> This is normal.

What's behind that?  Is it widening the results before the mincount
constraint is being applied?


> I couldn't fully follow, but you want something like multi-select
> faceting?
> 
> http://search-lucene.com/ is an example for that, user can select solr and
> lucene from the project facet > at the same time.
> 
> http://wiki.apache.org/solr/SimpleFacetParameters#Multi-Select_Faceting_and_LocalParams


No.  Search-Lucene actually appears to remove facets when they're not
returned.  If you select Blue, and Red is eliminated, Red won't show up as a
facet anymore.  Therefore, the user select Red to add it back into the
result set.

Multi-selection keeps eliminated facets, but gives them virtual counts
related to the entire result set.  If you select Blue(32) and Red(10) is
eliminated, multi-selection causes Red(10) to be displayed.  Therefore, the
user can't tell that Red was eliminated, and the Red facet no longer has any
connection to the values int the result set.

What we need to do is show eliminated facets with a 0 count, so if you
select Blue (32) and Red (10) is eliminated, we show Red (0).  That
indicates that there are zero documents in the result set for Red, but Red
can still be selected to add Red documents back into the result set.


Thanks



-- 
View this message in context: http://lucene.472066.n3.nabble.com/Adding-fq-to-query-with-mincount-0-causes-unexpected-0-count-facet-values-to-be-returned-tp2236105p2236309.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Adding fq to query with mincount=0 causes unexpected 0-count facet values to be returned?

Posted by Ahmet Arslan <io...@yahoo.com>.
> I've noticed that performing a query with facet.mincount=0
> and no fq clauses
> results in a response where only facets with non-zero
> counts are returned,
> but adding in an fq clause (caused by a user selecting a
> non-zero-valued
> facet value checkbox) actually causes a bunch of 0-count
> facet values
> completely unrelated to the query to be returned.
> 
> Is adding the fq constraint actually widening the query
> before
> facet.mincount gets applied?  
> 
> E.g., say a query with no fq constraint produces the
> following facet values:
> 
> ID
> 1234 (1)
> 1111 (15)
> 1010 (30)
> 
> Title
> Red (11)
> Green (15)
> Blue (32)
> 
> but when the user selects Blue (32), and I add
> &fq=Color:Blue, Solr returns
> the following:
> 
> ID
> 1 (0)
> 2 (0)
> 3 (0)
> ...
> 99 (0)
> 100 (0)
> 
> Color
> Orange (0)
> Teal (0)
> Red (0)
> Green (0)
> Blue (32)
> 
> 
> Notice how, before the fq clause is added, none of the
> 0-count facets are
> returned, even though facet.mincount = 0, but afterward, a
> bunch of 0-count
> facets are returned?

This is normal.

> The context of my question is trying to solve a problem
> where the
> application must display facet values with a count of zero
> as filtering
> operations remove them from the result set.  That is,
> if Red (10) was
> displayed after the initial query, but the user filters on
> Blue (32), then
> we must still display Red (0) so the user can select it and
> widen the query.  
> Initially, we were using mincount=1 and managing the
> missing facets entirely
> within the application, but now I'm trying to see if we can
> use mincount=0
> and maybe some other constraints to achieve the same
> behavior without a lot
> of custom code in the application.

I couldn't fully follow, but you want something like multi-select faceting?

http://search-lucene.com/ is an example for that, user can select solr and lucene from the project facet at the same time.

http://wiki.apache.org/solr/SimpleFacetParameters#Multi-Select_Faceting_and_LocalParams