Chris Hostetter wrote:

:  I built a wrong query string "word1,word2,word3" instead of "word1
: word2 word3"
: therefore I got a wrong query:  field:"word1 word2 word3" instead of
: field:word1 field:word2  field:word3.
:
:  Is this an espected behaviour?
:  I used Standard analyzer, probably therefore, the comas were replaced
: with spaces.

the commas weren't replaced ... your analyzer split on them and threw
them away.

they key to understanding why that resulted in a phrase query instead of
three term queries is that QueryParser doesn't treat comma as a special
character, so it saw the string word1,word2,word3 and gave it to your
analyzer.  Since your analyzer gave back several tokens QueryParser built
a phrase query out of it.
Exactly this is my question, why the QueryParser creates a Phrase query when he gets several tokens from analyzer
and not a BooleanQuery?

likewise, in the case of "word1 word2 word3" the quotes *are* a special
character to QueryParser which tells it it should *not* split on the
spaces betwen the quotes, and hand the individual words to the analyzer.
instead it hands the whole thing to the analyzer as one big string again.

It was not this situation, the string was without quotes.... (String searchString = "word1,word2,word3"; )
I just preserved java quotes to delimit the string.

:  Is this a bug? Does it make sense to indicate this situation through a
: Parse Exception?

a parse error should really onl come up when the query parser sees a
character that it does consider special, but sees it in a place that
doesn't make sense (or doesn't see one in a plkace it needs one).  in this
case QP is perfectly happy to let you query for a word that contains a
comma -- it's your analyzer that's putting it's foot down and saying that
can't be in a word.
Ok .. it is not the case of ParseException, should situations like this (change from TermQuery to PhraseQuery) indicated in log files? I mean, this will help developers to debug their code easier.

Best,

Sergiu


-Hoss


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




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

Reply via email to