Works for me.
Here is what I am striving to achieve.

phraseString =  request.getParameter("phrase");
if (phraseString.length() > 0){
        phraseQueryString = "\""+phraseString+("\"");
        phraseQuery = true;
        queryString = phraseQueryString;
}

if(phraseQuery){
        PhraseQuery pQuery = new PhraseQuery();
        pQuery.add(new Term("contents", phraseString));
        pQuery.setSlop(0);
        QueryParser qP = new QueryParser();
        query = qP.parse(phraseString);
}

This is piece of the code, what I intend to do is if there is any keyword entered in the Exact Phrase field of the form I want to use the phrase query other wise use regular Query.

Please correct the code if you'll think it is not correct. I am still learning about search and Lucene in general.

thanks.
-H

Erik Hatcher wrote:


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to