lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-4838) Add getOrd to BytesRefHash
Date Sat, 16 Mar 2013 13:24:12 GMT

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

Shai Erera commented on LUCENE-4838:
------------------------------------

I chose this name because ordinal appears everywhere on the API:

* Class javadoc: "BytesRefHash maintains mappings of byte arrays to ordinal..."
* Class member: {{private int[] ords}}
* Method add() javadocs: "return the ord the given bytes are hashed..."
* Method get(int ord): in the signature and javadocs: "Populates and returns ... for the given
ord"

So it seems that getOrd fits with the rest of the API. Nevertheless, do you have a suggestion
for another name?
                
> Add getOrd to BytesRefHash
> --------------------------
>
>                 Key: LUCENE-4838
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4838
>             Project: Lucene - Core
>          Issue Type: New Feature
>          Components: core/other
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>            Priority: Minor
>         Attachments: LUCENE-4838.patch
>
>
> There is no API today to query BytesRefHash for the existence of a certain BytesRef.
Rather, you should use .add(), which looks up the given bytes, and hashes them if they are
not found, or returns their ord if they are found.
> I would like to add a simple getOrd API which will return the ord of a given BytesRef,
or -1 if not found. I would like to use that API in the facet module, and I need to be able
to query the hash without necessarily adding elements to it.
> I have a simple patch, will post shortly.

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


Mime
View raw message