lucene-java-user mailing list archives

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

- 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

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: raghavendra.k.rao@barclays.com
> [mailto:raghavendra.k.rao@barclays.com]
> Sent: Friday, July 12, 2013 5:08 AM
> To: java-user@lucene.apache.org
> 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:
> www.barclays.com/emaildisclaimer.
> 
> For important disclosures, please see:
> www.barclays.com/salesandtradingdisclaimer 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 http://publicresearch.barclays.com.
> 
> _______________________________________________
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


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


Mime
View raw message