On Jul 27, 2004, at 11:42 AM, Hetan Shah wrote:
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);
}

I don't understand what you're attempting in the above. You don't make a new Term and add it to a PhraseQuery instance with the term having quotes around it - it is QueryParser that deals with quoted strings and interpreting it into a PhraseQuery.


Are you using pQuery? Or query? You've got two Query instances there - query is the one you probably want.

        Erik


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



Reply via email to