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 Jamie Johnson <je...@gmail.com> on 2011/06/19 16:47:07 UTC

fq vs adding to query

Are there any hard and fast rules about when to use fq vs adding to the
query?  For instance if I started with a search of

camera

then wanted to add another keyword say digital, is it better to do

q=camera AND digital

or

q=camera&fq=digital

I know that fq isn't taken into account when doing highlighting, so what I
am currently doing is when there are facet based queries I am doing fqs but
everything else is being added to the query, so in the case above I would
have done q=camera AND digital.  If however there was a field called
category with values standard or digital I would have done
q=camera&fq=category:digital.  Any guidance would be appreciated.

Re: fq vs adding to query

Posted by Shawn Heisey <so...@elyograg.org>.
On 6/19/2011 10:00 AM, Markus Jelsma wrote:
> If you wan't to make good use of the filter cache then use filter queries.

Additionally, information in filter queries will not affect relevancy 
ranking.  If you want the terms you are using to affect the document 
scores, include them in the main query.  Filter queries are intended for 
just that -- filtering.  They do it very efficiently, especially if you 
reuse them frequently, which hits the filter cache as Markus said.  It's 
often good practice to break up your filter queries into multiple fq 
statements so that there's more likelihood that they will use the cache.

Thanks,
Shawn


Re: fq vs adding to query

Posted by Markus Jelsma <ma...@openindex.io>.
If you wan't to make good use of the filter cache then use filter queries.

> fq is filter-query, search based on category, timestamp, language etc. but
> I dont see any performance improvement if use 'keyword' in fq.
> 
> useCases :
> fq=lang:English&q=camera AND digital
> OR
> fq=time:[13023567 TO 13023900]&q=camera AND digital
> 
> On 19 June 2011 20:17, Jamie Johnson <je...@gmail.com> wrote:
> > Are there any hard and fast rules about when touse fq vs adding to the
> > query?  For instance if I started with a search of
> > camera
> > 
> > then wanted to add another keyword say digital, is it better to do
> > 
> > q=camera AND digital
> > 
> > or
> > 
> > q=camera&fq=digital
> > 
> > I know that fq isn't taken into account when doing highlighting, so what
> > I am currently doing is when there are facet based queries I am doing
> > fqs but everything else is being added to the query, so in the case
> > above I would have done q=camera AND digital.  If however there was a
> > field called category with values standard or digital I would have done
> > q=camera&fq=category:digital.  Any guidance would be appreciated.

Re: fq vs adding to query

Posted by Mohammad Shariq <sh...@gmail.com>.
fq is filter-query, search based on category, timestamp, language etc. but I
dont see any performance improvement if use 'keyword' in fq.

useCases :
fq=lang:English&q=camera AND digital
OR
fq=time:[13023567 TO 13023900]&q=camera AND digital


On 19 June 2011 20:17, Jamie Johnson <je...@gmail.com> wrote:

> Are there any hard and fast rules about when touse fq vs adding to the
> query?  For instance if I started with a search of
> camera
>
> then wanted to add another keyword say digital, is it better to do
>
> q=camera AND digital
>
> or
>
> q=camera&fq=digital
>
> I know that fq isn't taken into account when doing highlighting, so what I
> am currently doing is when there are facet based queries I am doing fqs but
> everything else is being added to the query, so in the case above I would
> have done q=camera AND digital.  If however there was a field called
> category with values standard or digital I would have done
> q=camera&fq=category:digital.  Any guidance would be appreciated.
>



-- 
Thanks and Regards
Mohammad Shariq