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

Andrew Lundgren commented on SOLR-4610:
---------------------------------------

It has been pointed out to me that QueryParsing.toString(...) will allow you to 
print a query, assuming you have  given the schema.

>From the doc:
"The benefit of using this method instead of calling Query.toString directly is 
that it knows about the data types of each field, so any field which is encoded 
in a particularly complex way is still readable. The downside is that it only 
knows about built in Query types, and will not be able to format custom Query 
classes."

This solves the issue for stock query types.  Having the type embedded along 
with the term would allow you to use toString on the query in a more natural 
way, and allow custom queries to print properly.

                
> Calling query.toString will print binary values for encoded integer values in 
> terms.
> ------------------------------------------------------------------------------------
>
>                 Key: SOLR-4610
>                 URL: https://issues.apache.org/jira/browse/SOLR-4610
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 3.4, 3.6.2, 4.1, 4.2
>            Reporter: Andrew Lundgren
>
> When calling toSting on a query that contains terms with encoded integers, 
> the encoded integers are not decoded using the encodedToReadable() call.  
> The result is that the integers are printed out as their encoded binary form 
> rather than a readable form.
> Investigating the Term.java showed that the toString method just converts the 
> utf8bytes to a string.  There isn't any indication of the data type stored in 
> the bytes at this level.  Without the data type, it does not appear that the 
> term can be correctly printed without access to the schema (not a good 
> thing).  
> I think to fix this, it might require adding the type into the term and all 
> of the plumbing to get the type passed down to this low level.  
> This could be done with setters that accept specific types and handle the 
> encoding themselves.

--
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: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to