Hi Yonik,
  Thanks for your quick reply. I'm very new to the lucene source code.
Can you give me a little more detail explaination about this.
Do you think it will save some memory if docnum = find_match("A") >
docnum = find_match("B") and put B in the front of the AND query like "B
AND A AND C"? How about sorting (sort=A,B,C&q=A AND B AND C)? Do you
think the order of conditions (A,B,C) in a query will affect the
performance of the query?
  Thank you very much.
  Yongjun
    

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yonik
Seeley
Sent: Thursday, May 29, 2008 4:12 PM
To: solr-user@lucene.apache.org
Subject: Re: Search query optimization

On Thu, May 29, 2008 at 4:05 PM, Yongjun Rong <[EMAIL PROTECTED]>
wrote:
>  I have a question about how the lucene query parser. For example, I 
> have query "A AND B AND C". Will lucene extract all documents satisfy 
> condition A in memory and then filter it with condition B and C?

No, Lucene will try and optimize this the best it can.

It roughly goes like this..
docnum = find_match("A")
docnum = find_first_match_after(docnum, "B") docnum =
find_first_match_after(docnum,"C")
etc...
until the same docnum is returned for "A","B", and "C".

See ConjunctionScorer for the gritty details.

-Yonik



> or only
> the documents satisfying "A AND B AND C" will be put into memory? Is 
> there any articles discuss about how to build a optimization query to 
> save memory and improve performance?
>  Thank you very much.
>  Yongjun Rong
>

Reply via email to