You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Yonik Seeley (JIRA)" <ji...@apache.org> on 2010/05/03 17:00:57 UTC

[jira] Created: (LUCENE-2438) BytesRef improvements

BytesRef improvements
---------------------

                 Key: LUCENE-2438
                 URL: https://issues.apache.org/jira/browse/LUCENE-2438
             Project: Lucene - Java
          Issue Type: Bug
    Affects Versions: 4.0.0
            Reporter: Yonik Seeley


Make BytesRef comparable, document that byte[] should not be null, remove explicit null check + allocation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Issue Comment Edited: (LUCENE-2438) BytesRef improvements

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12863393#action_12863393 ] 

Yonik Seeley edited comment on LUCENE-2438 at 5/3/10 12:33 PM:
---------------------------------------------------------------

Looks like BytesRef.equals() is incorrect... I'll fix.

edit: no it's not... I keep seeing length as bytes.length ;-)

      was (Author: yseeley@gmail.com):
    Looks like BytesRef.equals() is incorrect... I'll fix.
  
> BytesRef improvements
> ---------------------
>
>                 Key: LUCENE-2438
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2438
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Yonik Seeley
>         Attachments: LUCENE-2438.patch, LUCENE-2438.patch, LUCENE-2438.patch
>
>
> Make BytesRef comparable, document that byte[] should not be null, remove explicit null check + allocation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2438) BytesRef improvements

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley updated LUCENE-2438:
---------------------------------

    Attachment: LUCENE-2438.patch

Here's an updated version.  Uwe is now also working on this, so I won't make further changes.

> BytesRef improvements
> ---------------------
>
>                 Key: LUCENE-2438
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2438
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Yonik Seeley
>         Attachments: LUCENE-2438.patch, LUCENE-2438.patch
>
>
> Make BytesRef comparable, document that byte[] should not be null, remove explicit null check + allocation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2438) BytesRef improvements

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12863422#action_12863422 ] 

Yonik Seeley commented on LUCENE-2438:
--------------------------------------

Another issue is that it looks like some code assumes that offset==0 (and this is reinforced by the naming of BytesRef.length, which we should consider changing to BytesRef.len)

Most of these seem sort-of OK... it's after a UTF16TOUTF8, which always makes the offset zero.  But if we depend on this, it should be documented.

For example:
org.apache.lucene.document.CompressionTools#compressString
org.apache.lucene.index.codecs.pulsing.PulsingPostingsWriterImpl#finishTerm
org.apache.lucene.store.DataOutput#writeString

> BytesRef improvements
> ---------------------
>
>                 Key: LUCENE-2438
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2438
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Yonik Seeley
>         Attachments: LUCENE-2438.patch, LUCENE-2438.patch, LUCENE-2438.patch
>
>
> Make BytesRef comparable, document that byte[] should not be null, remove explicit null check + allocation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2438) BytesRef improvements

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12863414#action_12863414 ] 

Uwe Schindler commented on LUCENE-2438:
---------------------------------------

We should keep the issue open after the commit, as there is more to do. I only changed the code parts that were done by me, maybe Mike has other ones with null checks.

> BytesRef improvements
> ---------------------
>
>                 Key: LUCENE-2438
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2438
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Yonik Seeley
>         Attachments: LUCENE-2438.patch, LUCENE-2438.patch, LUCENE-2438.patch
>
>
> Make BytesRef comparable, document that byte[] should not be null, remove explicit null check + allocation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2438) BytesRef improvements

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12863393#action_12863393 ] 

Yonik Seeley commented on LUCENE-2438:
--------------------------------------

Looks like BytesRef.equals() is incorrect... I'll fix.

> BytesRef improvements
> ---------------------
>
>                 Key: LUCENE-2438
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2438
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Yonik Seeley
>         Attachments: LUCENE-2438.patch, LUCENE-2438.patch, LUCENE-2438.patch
>
>
> Make BytesRef comparable, document that byte[] should not be null, remove explicit null check + allocation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2438) BytesRef improvements

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12863440#action_12863440 ] 

Uwe Schindler commented on LUCENE-2438:
---------------------------------------

I fixed NumericUtils to do the same in rev 940545.

> BytesRef improvements
> ---------------------
>
>                 Key: LUCENE-2438
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2438
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Yonik Seeley
>         Attachments: LUCENE-2438.patch, LUCENE-2438.patch, LUCENE-2438.patch
>
>
> Make BytesRef comparable, document that byte[] should not be null, remove explicit null check + allocation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2438) BytesRef improvements

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yonik Seeley updated LUCENE-2438:
---------------------------------

    Attachment: LUCENE-2438.patch

> BytesRef improvements
> ---------------------
>
>                 Key: LUCENE-2438
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2438
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Yonik Seeley
>         Attachments: LUCENE-2438.patch
>
>
> Make BytesRef comparable, document that byte[] should not be null, remove explicit null check + allocation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2438) BytesRef improvements

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-2438:
----------------------------------

    Attachment: LUCENE-2438.patch

Here my version with other CTA and NTS changes.

> BytesRef improvements
> ---------------------
>
>                 Key: LUCENE-2438
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2438
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Yonik Seeley
>         Attachments: LUCENE-2438.patch, LUCENE-2438.patch, LUCENE-2438.patch
>
>
> Make BytesRef comparable, document that byte[] should not be null, remove explicit null check + allocation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2438) BytesRef improvements

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12863433#action_12863433 ] 

Yonik Seeley commented on LUCENE-2438:
--------------------------------------

I've added javadoc that defines result.offset to be 0 after the UTF16toUTF8 methods.
I also clarified that the byte[] one passes in is directly referenced instead of copied... which implies that BytesRef(byte[]) will cause offset to be 0.

> BytesRef improvements
> ---------------------
>
>                 Key: LUCENE-2438
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2438
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Yonik Seeley
>         Attachments: LUCENE-2438.patch, LUCENE-2438.patch, LUCENE-2438.patch
>
>
> Make BytesRef comparable, document that byte[] should not be null, remove explicit null check + allocation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2438) BytesRef improvements

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12863384#action_12863384 ] 

Yonik Seeley commented on LUCENE-2438:
--------------------------------------

Looks good.
This is trunk, and currently lucene.internal, so I'll commit shortly.

> BytesRef improvements
> ---------------------
>
>                 Key: LUCENE-2438
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2438
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Yonik Seeley
>         Attachments: LUCENE-2438.patch, LUCENE-2438.patch, LUCENE-2438.patch
>
>
> Make BytesRef comparable, document that byte[] should not be null, remove explicit null check + allocation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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