On Jan 11, 2010, at 1:33 PM, Avlesh Singh wrote:
It is in the source code of QueryParser's getFieldQuery(String field,
String queryText) method line#660. If numTokens > 1 it returns
Phrase
Query.
That's exactly the question. Would be nice to hear from someone as
to why is
it that way?
Suppose you indexed "Foo Bar". It'd get indexed as two tokens [foo]
followed by [bar]. Then someone searches for foo-bar, which would get
analyzed into two tokens also. A PhraseQuery is the most logical
thing for it to turn into, no?
What's the alternative?
Of course it's tricky business though, impossible to do the right
thing for all cases within SolrQueryParser. Thankfully it is
pleasantly subclassable and overridable for this method.
Erik