lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <>
Subject RE: Searching two words
Date Fri, 12 Jul 2013 06:02:14 GMT

- if you want to search for those both words next to each other, use a phrase query. This
is by putting quotes around, QueryParser will parse this to a Lucene PhraseQuery
- If you don't want to have a phrase and just want to ensure that both words must be in the
document, prefix both words with a plus sign to make them mandatory


Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen

> -----Original Message-----
> From:
> []
> Sent: Friday, July 12, 2013 5:08 AM
> To:
> Subject: Searching two words
> Hi,
> When I search two words separated by a space, the search returns results
> consisting of the two word pattern and also searches the individual words
> separately.
> I don't have the code in front of me at the moment to give you my code
> snippet, but I can tell the following.
> I use the standard analyzer.
> Query parser.
> I don't use Multi field parser.
> I concatenate all my fields as contents and search the provided string.
> There is no issue with single words. I want to avoid it from searching the
> individual words separately. Do you have any suggestions please?
> Raghu
> _______________________________________________
> This message is for information purposes only, it is not a recommendation,
> advice, offer or solicitation to buy or sell a product or service nor an official
> confirmation of any transaction. It is directed at persons who are
> professionals and is not intended for retail customer use. Intended for
> recipient only. This message is subject to the terms at:
> For important disclosures, please see:
> regarding market commentary
> from Barclays Sales and/or Trading, who are active market participants; and in
> respect of Barclays Research, including disclosures relating to specific issuers,
> please see
> _______________________________________________
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message