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 arindam chakraborty <ar...@gmail.com> on 2012/08/30 19:51:25 UTC

Facet not working in Solr

Query parser = dismax
range query :
q=field:[a TO b]

DOESN'T WORK (Less important question. WHY?)

Query parser = Lucene
range query:
q=field:[a TO b]

WORKS

Query parser = edismax
range query
q=field:[a TO b]

WORKS

PROBLEM:

Facet:

with query parser
a) Lucene
b) Dismax
c) eDismax

DOESN'T WORK.

params

q=&fq=&start=0&rows=100&fl=u_height,id,score&wt=&debugQuery=on&explainOther=&
*
facet=on&facet.range.other=all&facet.range.start=160.0&facet.range.end=172.0&facet.range.gap=2.0&facet.range=u_height&facet.range.include=all
*&defType=edismax

Any ideas ?


Arindam

Re: Facet not working in Solr

Posted by arindam chakraborty <ar...@gmail.com>.
Well yes, Thank you so much.

I had lost that point of * in the main query.
With that I get what I expect.

This was awesome. Thanks so much

On Fri, Aug 31, 2012 at 9:49 AM, Chris Hostetter
<ho...@fucit.org>wrote:

>
> : But faceting using the following URL gives numFound = 0, and all 0's in
> the
>         ...
> :
> q=&fq=&start=0&rows=100&fl=u_height,id,score&wt=&debugQuery=on&explainOther=&facet=on&facet.range.other=all&
>         ...
> : Adding a value in q with qf set  like so
> :
> : *q=165.0&qf=u_height*
> :
> &fq=&start=0&rows=100&fl=u_height,id,score&wt=&debugQuery=on&explainOther=&facet=on&facet.range.other=all&facet.range.start=160.0&facet.range.end=172.0&facet.range.gap=2.0&facet.range=u_height&facet.range.include=all&defType=edismax
> :
> : gives 8 documents as expected in numFound and facet count of 8 only in
> the
> : range of 164.0, whereas I would like to *get the facet counts of all the
> : ranges.*
> : Anything missing here?
>
> I think you are missunderstanidng the point of faceting.
>
> when you ask for range faceting (or field faceting, or query faceting) the
> counts are based on the result set of your main query -- the constraint
> counts tell you how many of the *results* match each constraint.
>
> If your main query matches 0 documents, then the constraint counts will
> match no documents.  if your main query matches 8 documents, then the
> constraint counts will tell you, for each constraint, how many of those 8
> documents match each constraint.
>
> If you want to know how many documents, in your entire index, match each
> facet constraint, then you need to use "q=*:*" (with the lucene or edismax
> parsers) to tell solr that you want the entire index to be treated as your
> main query.
>
>
> -Hoss
>

Re: Facet not working in Solr

Posted by Chris Hostetter <ho...@fucit.org>.
: But faceting using the following URL gives numFound = 0, and all 0's in the
	...
: q=&fq=&start=0&rows=100&fl=u_height,id,score&wt=&debugQuery=on&explainOther=&facet=on&facet.range.other=all&
	...
: Adding a value in q with qf set  like so
: 
: *q=165.0&qf=u_height*
: &fq=&start=0&rows=100&fl=u_height,id,score&wt=&debugQuery=on&explainOther=&facet=on&facet.range.other=all&facet.range.start=160.0&facet.range.end=172.0&facet.range.gap=2.0&facet.range=u_height&facet.range.include=all&defType=edismax
: 
: gives 8 documents as expected in numFound and facet count of 8 only in the
: range of 164.0, whereas I would like to *get the facet counts of all the
: ranges.*
: Anything missing here?

I think you are missunderstanidng the point of faceting.

when you ask for range faceting (or field faceting, or query faceting) the 
counts are based on the result set of your main query -- the constraint 
counts tell you how many of the *results* match each constraint.

If your main query matches 0 documents, then the constraint counts will 
match no documents.  if your main query matches 8 documents, then the 
constraint counts will tell you, for each constraint, how many of those 8 
documents match each constraint.

If you want to know how many documents, in your entire index, match each 
facet constraint, then you need to use "q=*:*" (with the lucene or edismax 
parsers) to tell solr that you want the entire index to be treated as your 
main query.


-Hoss

Re: Facet not working in Solr

Posted by arindam chakraborty <ar...@gmail.com>.
Again to elaborate,

the documents all have an indexed field called u_height which is between
160.0 to 172.0
Range queries work on them with the lucene and edismax.

But faceting using the following URL gives numFound = 0, and all 0's in the
facet counts

q=&fq=&start=0&rows=100&fl=u_height,id,score&wt=&debugQuery=on&explainOther=&facet=on&facet.range.other=all&
*facet.range.start=160.0&facet.range.end=172.0*&facet.range.gap=2.0&*
facet.range=u_height*&facet.range.include=all&defType=edismax


Adding a value in q with qf set  like so

*q=165.0&qf=u_height*
&fq=&start=0&rows=100&fl=u_height,id,score&wt=&debugQuery=on&explainOther=&facet=on&facet.range.other=all&facet.range.start=160.0&facet.range.end=172.0&facet.range.gap=2.0&facet.range=u_height&facet.range.include=all&defType=edismax

gives 8 documents as expected in numFound and facet count of 8 only in the
range of 164.0, whereas I would like to *get the facet counts of all the
ranges.*
Anything missing here?

Arindam


On Fri, Aug 31, 2012 at 4:33 AM, Chris Hostetter
<ho...@fucit.org>wrote:

>
> : Query parser = dismax
> : range query :
> : q=field:[a TO b]
> :
> : DOESN'T WORK (Less important question. WHY?)
>
> dismax does not support range query syntax, it never has...
>
> https://wiki.apache.org/solr/DisMaxQParserPlugin#Query_Syntax
>
> : Facet:
>         ...
> : DOESN'T WORK.
>
> Define "DOESN'T WORK" ... what do you expect to get? what do you actaully
> get? is there an error message?
>
>         https://wiki.apache.org/solr/UsingMailingLists
>
> :
> q=&fq=&start=0&rows=100&fl=u_height,id,score&wt=&debugQuery=on&explainOther=&
> :
> facet=on&facet.range.other=all&facet.range.start=160.0&facet.range.end=172.0&facet.range.gap=2.0&facet.range=u_height&facet.range.include=all
> : *&defType=edismax
>
> you're q param is empty, so I unless you have other param defaults in your
> solrconfig you haven't told us about, I suspect you are getting an error
> about needing a q param -- which has nothing to do with faceting -- what
> documents do you want to facet over?
>
>
> -Hoss
>

Re: Facet not working in Solr

Posted by arindam chakraborty <ar...@gmail.com>.
Okay my bad for the lack of info :


   - When I say doesn't work means numFound = 0
   - Whereas range queries on the same fields give documents
   - Even adding a value in q gives numFound = 0. using all 3 types of
   parsers. Even if dismax doesn't support range queries. edismax and lucene
   should give the result > 0, right?



On Fri, Aug 31, 2012 at 4:33 AM, Chris Hostetter
<ho...@fucit.org>wrote:

>
> : Query parser = dismax
> : range query :
> : q=field:[a TO b]
> :
> : DOESN'T WORK (Less important question. WHY?)
>
> dismax does not support range query syntax, it never has...
>
> https://wiki.apache.org/solr/DisMaxQParserPlugin#Query_Syntax
>
> : Facet:
>         ...
> : DOESN'T WORK.
>
> Define "DOESN'T WORK" ... what do you expect to get? what do you actaully
> get? is there an error message?
>
>         https://wiki.apache.org/solr/UsingMailingLists
>
> :
> q=&fq=&start=0&rows=100&fl=u_height,id,score&wt=&debugQuery=on&explainOther=&
> :
> facet=on&facet.range.other=all&facet.range.start=160.0&facet.range.end=172.0&facet.range.gap=2.0&facet.range=u_height&facet.range.include=all
> : *&defType=edismax
>
> you're q param is empty, so I unless you have other param defaults in your
> solrconfig you haven't told us about, I suspect you are getting an error
> about needing a q param -- which has nothing to do with faceting -- what
> documents do you want to facet over?
>
>
> -Hoss
>

Re: Facet not working in Solr

Posted by Chris Hostetter <ho...@fucit.org>.
: Query parser = dismax
: range query :
: q=field:[a TO b]
: 
: DOESN'T WORK (Less important question. WHY?)

dismax does not support range query syntax, it never has...

https://wiki.apache.org/solr/DisMaxQParserPlugin#Query_Syntax

: Facet:
	...
: DOESN'T WORK.

Define "DOESN'T WORK" ... what do you expect to get? what do you actaully 
get? is there an error message?

	https://wiki.apache.org/solr/UsingMailingLists

: q=&fq=&start=0&rows=100&fl=u_height,id,score&wt=&debugQuery=on&explainOther=&
: facet=on&facet.range.other=all&facet.range.start=160.0&facet.range.end=172.0&facet.range.gap=2.0&facet.range=u_height&facet.range.include=all
: *&defType=edismax

you're q param is empty, so I unless you have other param defaults in your 
solrconfig you haven't told us about, I suspect you are getting an error 
about needing a q param -- which has nothing to do with faceting -- what 
documents do you want to facet over?


-Hoss