On Jun 28, 2004, at 2:59 PM, Hetan Shah wrote:

I was wondering if anyone out there had tried the PhraseQuery class and retrieved the results. I'm new to the whole search solution. I have a need to do a exact phrase search. Any code sample would be really appreciated.

PhraseQuery query = new PhraseQuery();

    for (int i=0; i < words.length; i++) {
      query.add(new Term("field", phrase[i]));
    }

That builds a PhraseQuery from a String[] of words and will be an exact match (unless you called setSlop with something greater than zero).

        Erik


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



Reply via email to