Documents with both terms are likely to be returned first because they
are likely to score higher, but that isn't guaranteed.  Google "lucene
scoring" for details.

If you absolutely must have docs with both terms first, you could
execute 2 searches: the first with AND and the second with OR, then
dedup the hit lists.

Or if you are using QueryParser, use 2 clauses with boosting.  Something like

(foo AND bar)^4 (foo bar)

That syntax might be wrong.  See
http://lucene.apache.org/java/3_3_0/queryparsersyntax.html for
details.  The same idea will also apply if you are building your
queries up in code.


--
Ian.


On Fri, Sep 9, 2011 at 12:32 PM, dyzc2010 <zhoucheng2...@gmail.com> wrote:
> Hi,
>
>
> I am trying to use OR operator, and want to know if it returns the results 
> comprising of both keywords contained first and then either keyword later.
>
>
> To be more clear, if A OR B is enforced, should results with A and B are 
> returned first?
>
>
> If not, how can I make sure that the OR operator can do the job.
>
>
> Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to