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