: I am trying to get Lucene to perform an exact match on a single term or word : using the default query parser. It works fine whenever I have more than one : word / term in the search string (it parses the string into a PhraseQuery : with a slop of 0 which is correct). However when the search string just : contains a single word ie "state", the query parser parses this into a : TermQuery despite the quotes when I would have expected a phrase query. : Is there any easy way around this?
the quotes tell the query parser to send the entire contents of the string to the analyzer -- even if it has spaces (which query parser would normally split on) and if your analyzer returns one token query parser makes a TermQuery and if it returns more then one toke query parser makes a PhraseQuery. the real question is: why do you feel TermQuery is the wrong thing to use in this case? ... if you're searching for a single Term, it's what makes the most sense. -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]