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 roz dev <ro...@gmail.com> on 2011/09/21 07:55:38 UTC

q and fq in solr 1.4.1

Hi All

I am sure that q vs fq question has been answered several times.

But, I still have a question which I would like to know the answers for:

if we have a solr query like this

q=*&fq=field_1:XYZ&fq=field_2:ABC&sortBy=field_3+asc

How does SolrIndexSearcher fire query in 1.4.1

Will it fire query against whole index first because q=* then filter the
results against field_1 and field_2 or is it in parallel?

and, if we say that get only 20 rows at a time then will solr do following
1) get all the docs (because q is set to *) and sort them by field_3
2) then, filter the results by field_1 and field_2

Or, will it apply sorting after doing the filter?

Please let me know how Solr 1.4.1 works.

Thanks
Saroj

Re: q and fq in solr 1.4.1

Posted by Erick Erickson <er...@gmail.com>.
Why is it important? What are you worried about that this implementation
detail is necessary to know about?

But the short answer is that the fq's are calculated against the whole index
and the results are efficiently cached. That's the only way that the fq can
be re-used against a different search term. The fq clauses are applied before
sorting.

Best
Erick

On Tue, Sep 20, 2011 at 10:55 PM, roz dev <ro...@gmail.com> wrote:
> Hi All
>
> I am sure that q vs fq question has been answered several times.
>
> But, I still have a question which I would like to know the answers for:
>
> if we have a solr query like this
>
> q=*&fq=field_1:XYZ&fq=field_2:ABC&sortBy=field_3+asc
>
> How does SolrIndexSearcher fire query in 1.4.1
>
> Will it fire query against whole index first because q=* then filter the
> results against field_1 and field_2 or is it in parallel?
>
> and, if we say that get only 20 rows at a time then will solr do following
> 1) get all the docs (because q is set to *) and sort them by field_3
> 2) then, filter the results by field_1 and field_2
>
> Or, will it apply sorting after doing the filter?
>
> Please let me know how Solr 1.4.1 works.
>
> Thanks
> Saroj
>