[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lucene-dev
Subject:    [jira] Created: (LUCENE-2942) toString() methods on
From:       "Robert Muir (JIRA)" <jira () apache ! org>
Date:       2011-02-28 17:35:37
Message-ID: 1417745295.2184.1298914537005.JavaMail.tomcat () hel ! zones ! apache ! org
[Download RAW message or body]

toString() methods on term/queries/etc are wrong: assume utf-8 encoded bytes.
-----------------------------------------------------------------------------

                 Key: LUCENE-2942
                 URL: https://issues.apache.org/jira/browse/LUCENE-2942
             Project: Lucene - Java
          Issue Type: Bug
    Affects Versions: 4.0
            Reporter: Robert Muir


In Lucene's trunk, a Term is just a Bytesref.
In a lot of cases this is a UTF-8 encoded string, but in some cases its not (e.g. \
collation fields).

The problem is that the toString methods all currently call utf8ToString().
This is wrong, though from a practical point of view i think just printing the bytes \
won't be very helpful for debugging most cases where the bytes really are utf-8 \
encoded.

So i think in these cases we should use the following technique: if the bytes are a \
valid utf-8 sequence, use BytesRef.utf8tostring(), otherwise just print the bytes: \
BytesRef.toString()

its no problem for performance because toString is only for debugging anyway.


-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic