Bingo..!!..Your solution worked for me.

Thanks a ton. I went through queryparser so many number of times never knew it can server the purpose so easily.

Never figured out the true significance as I thought I can always create a normal PhraseQuery with PhraseQuery pq=new PhraseQuery() and then use it..

Planning to use queryParser for WildCardQuery/Prefix/Boolean also instead of separately constructing queries for respective query type..Any suggestion/pitfall in this regard will be very useful.


On 7/27/2013 4:06 PM, Michael McCandless wrote:
On Sat, Jul 27, 2013 at 3:20 AM, Ankit Murarka
<ankit.mura...@rancoretech.com>  wrote:
Ok.I went through the Javadoc of PhraseQuery and tried using position
argument to phrasequery.

Problem encountered:

My text contains : Still it is not happening and generally i will be able to
complete it at the earliest.

The user enters search string : 1. still happening and 2. still it is not
happening.

Now, based on what I understood for the first input, I will add still at 0
and happening at 1 of the phrasequery position. This will not give me any
hit.
Right, this is expected, since in the document still happens at
position 0 and happening at position 4.

For second input, do I still need to add still at 0 and happening at 4 to
phrasequery position ? This will mean I need to store locally the stopwords
and every user input will then need to be parsed for stopwords and extract
required terms. This might not be a feasible solution anyday. Parsing user
input to discard stopwords and then search..    However, this is giving me
HIT but not at all recommended to implement by parsing user input.
Well, this is why we have query parsers: they do this for you
(analyzing the text, detect when stopwords were skipped, and construct
a PhraseQuery with the right values for "position").

Mike McCandless

http://blog.mikemccandless.com

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




--
Regards

Ankit Murarka

"Peace is found not in what surrounds us, but in what we hold within."


---------------------------------------------------------------------
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