public class CollatedTermAttributeImpl extends CharTermAttributeImpl
CharTermAttributeImpl that encodes the term
text as a binary Unicode collation key instead of as UTF-8 bytes.| Constructor and Description |
|---|
CollatedTermAttributeImpl(Collator collator)
Create a new CollatedTermAttributeImpl
|
| Modifier and Type | Method and Description |
|---|---|
int |
fillBytesRef()
Updates the bytes
TermToBytesRefAttribute.getBytesRef() to contain this term's
final encoding, and returns its hashcode. |
append, append, append, append, append, append, buffer, charAt, clear, clone, copyBuffer, copyTo, equals, getBytesRef, hashCode, length, reflectWith, resizeBuffer, setEmpty, setLength, subSequence, toStringreflectAsStringchars, codePointspublic CollatedTermAttributeImpl(Collator collator)
collator - Collation key generatorpublic int fillBytesRef()
TermToBytesRefAttributeTermToBytesRefAttribute.getBytesRef() to contain this term's
final encoding, and returns its hashcode.fillBytesRef in interface TermToBytesRefAttributefillBytesRef in class CharTermAttributeImplBytesRef.hashCode():
int hash = 0;
for (int i = termBytes.offset; i < termBytes.offset+termBytes.length; i++) {
hash = 31*hash + termBytes.bytes[i];
}
Implement this for performance reasons, if your code can calculate
the hash on-the-fly. If this is not the case, just return
termBytes.hashCode().Copyright © 2010 - 2020 Adobe. All Rights Reserved