Itamar Syn-Hershko created LUCENE-4673:
------------------------------------------
Summary: TermQuery.toString() doesn't play nicely with whitespace
Key: LUCENE-4673
URL: https://issues.apache.org/jira/browse/LUCENE-4673
Project: Lucene - Core
Issue Type: Bug
Components: core/search
Affects Versions: 3.6.2, 4.0-BETA, 4.1
Reporter: Itamar Syn-Hershko
A TermQuery where term.text() contains whitespace outputs incorrect string
representation: field:foo bar instead of field:"foo bar". A "correct"
representation is such that could be parsed again to the correct Query object
(using the correct analyzer, yes, but still).
This may not be so critical, but in our system we use Lucene's QP to parse and
then pre-process and optimize user queries. To do that we use Query.toString on
some clauses to rebuild the query string.
This can be easily resolved by always adding quote marks before and after the
term text in TermQuery.toString. Testing to see if they are required or not is
too much work and TermQuery is ignorant of quote marks anyway.
Some other scenarios which could benefit from this change is places where
escaped characters are used, such as URLs.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]