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

Uwe Schindler commented on LUCENE-4690:
---------------------------------------

bq. As far as I can tell nothing actually uses the hash codes generated by 
these methods (not even any tests).

The return value (the hash) is used by 
NumericTokenStreeam#NumericTermAttribute.fillBytesRef():

{code:java}
    @Override
    public int fillBytesRef() {
      try {
        assert valueSize == 64 || valueSize == 32;
        return (valueSize == 64) ? 
          NumericUtils.longToPrefixCoded(value, shift, bytes) :
          NumericUtils.intToPrefixCoded((int) value, shift, bytes);
      } catch (IllegalArgumentException iae) {
        // return empty token before first or after last
        bytes.length = 0;
        return 0;
      }
    }
{code}

Other comments:
- The masking away of invalid shifts is a no-go to me. This leads to unexpected 
behaviour.
- A agree grow() does not need to be used for this stuff. We can simply 
reallocate, as we know size exactly.
                
> remove hashing from NumericUtils.*ToPrefixCoded 
> ------------------------------------------------
>
>                 Key: LUCENE-4690
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4690
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Yonik Seeley
>
> As far as I can tell nothing actually uses the hash codes generated by these 
> methods (not even any tests).  If someone did want to generate a hash, it 
> would be just as fast to do it on the BytesRef after the fact (or even faster 
> from the input number itself).

--
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