[ 
https://issues.apache.org/jira/browse/LUCENE-4673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13548874#comment-13548874
 ] 

Itamar Syn-Hershko commented on LUCENE-4673:
--------------------------------------------

I figured as much, yet we would definitely like to have use this behavior 
built-in. Are there any plans on making such an interface to perform a proper 
Query -> String conversion?
                
> 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: 4.0-BETA, 4.1, 3.6.2
>            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]

Reply via email to