You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Hrishikesh Agashe <hr...@persistent.co.in> on 2009/10/31 05:58:45 UTC

Basic searching doubt

Hi,

If I search for string "A B" (i.e. A followed by a space followed by B) and I get 20 hits, then is it correct to expect that if I search for "A" (i.e. only A), I will get at least 20 hit or more? Similarly for if I search for B, I will get 20 hits or more?

--Hrishi

DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

Re: Basic searching doubt

Posted by Raf <r....@gmail.com>.
If you search "A B" (with quotes) it is correct, but if you search only A B
(without quotes) it is not correct, because, by default the query parser
creates "OR" queries.
So searching   A B  you will find all documents that contains A or B, while
searching only A or only B you will normally find less documents!
If you want to search all documents that contains A and B, you should write
the query as +A +B (or change the default operator for query parser from OR
to AND).

Bye
Raf

On Sat, Oct 31, 2009 at 5:58 AM, Hrishikesh Agashe <
hrishikesh_agashe@persistent.co.in> wrote:

> Hi,
>
> If I search for string "A B" (i.e. A followed by a space followed by B) and
> I get 20 hits, then is it correct to expect that if I search for "A" (i.e.
> only A), I will get at least 20 hit or more? Similarly for if I search for
> B, I will get 20 hits or more?
>
> --Hrishi
>
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is
> the property of Persistent Systems Ltd. It is intended only for the use of
> the individual or entity to which it is addressed. If you are not the
> intended recipient, you are not authorized to read, retain, copy, print,
> distribute or use this message. If you have received this communication in
> error, please notify the sender and delete all copies of this message.
> Persistent Systems Ltd. does not accept any liability for virus infected
> mails.
>