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 Jae Joo <ja...@gmail.com> on 2008/11/24 15:55:54 UTC

Facet Query (fq) and Query (q)

I am having some trouble to utilize the facet Query. As I know that the
facet Query has better performance that simple query (q).
Here is the example.

http://localhost:8080/test_solr/select?q=*:*&facet=true&fq=state:CA&facet.mincount=1&facet.field=city&facet.field=sector&facet.limit=-1&sort=score+desc

--> facet by sector and city for state of CA.
Any idea how to optimize this query to avoid "q=*:*"?

Thanks,

Jae

Re: Facet Query (fq) and Query (q)

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
First, terminology clarification.  fq is *filter* query.  facet.query  
is facet query.


On Nov 24, 2008, at 9:55 AM, Jae Joo wrote:
> I am having some trouble to utilize the facet Query. As I know that  
> the
> facet Query has better performance that simple query (q).

The performance is (about?) the same, caches excluded.  But fq's get  
added to the filterCache, q's to the queryCache.

> Here is the example.
>
> http://localhost:8080/test_solr/select?q=*:*&facet=true&fq=state:CA&facet.mincount=1&facet.field=city&facet.field=sector&facet.limit=-1&sort=score+desc
>
> --> facet by sector and city for state of CA.
> Any idea how to optimize this query to avoid "q=*:*"?

In this case you could use q=state:CA and remove fq=state:CA, but  
performance-wise as well as all other things considered, I'd stick  
with what you've got - just warm those filterCaches up and your  
performance should be quite acceptable.  Report back with more details  
if not.

	Erik