[jira] Commented: (LUCENE-2380) Add FieldCache.getTermBytes, to load term data as byte[]

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] Commented: (LUCENE-2380) Add FieldCache.getTermBytes, to load term data as byte[]

JIRA jira@apache.org

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

Yonik Seeley commented on LUCENE-2380:

One thing to keep in mind is that the current way of returning shared BytesRef objects often forces one to make a copy.  We should perhaps consider allowing a BytesRef to be passed in.

// returning shared BytesRef forces a copy
for(;;) {
  BytesRef val1 = new BytesRef(getValue(doc1))  // make a copy
  BytesRef val2 = getValue(doc2)
  int cmp = val1.compareTo(val2)

// allowing BytesRef to be passed in means no copy
BytesRef val1 = new BytesRef();
BytesRef val2 = new BytesRef();
for(;;) {
  getValue(doc1, val1)
  getValue(doc2, val2)
  int cmp = val1.compareTo(val2)

> Add FieldCache.getTermBytes, to load term data as byte[]
> --------------------------------------------------------
>                 Key: LUCENE-2380
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2380
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 4.0
> With flex, a term is now an opaque byte[] (typically, utf8 encoded unicode string, but not necessarily), so we need to push this up the search stack.
> FieldCache now has getStrings and getStringIndex; we need corresponding methods to load terms as native byte[], since in general they may not be representable as String.  This should be quite a bit more RAM efficient too, for US ascii content since each character would then use 1 byte not 2.

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: [hidden email]
For additional commands, e-mail: [hidden email]