Interface ITermToBytesRefAttribute
This attribute is requested by TermsHashPerField to index the contents. This attribute can be used to customize the final byte[] encoding of terms.
Consumers of this attribute call Bytes
TermToBytesRefAttribute termAtt = tokenStream.GetAttribute<TermToBytesRefAttribute>;
BytesRef bytes = termAtt.BytesRef;
while (tokenStream.IncrementToken()
{
// you must call termAtt.FillBytesRef() before doing something with the bytes.
// this encodes the term value (internally it might be a char[], etc) into the bytes.
int hashCode = termAtt.FillBytesRef();
if (IsInteresting(bytes))
{
// because the bytes are reused by the attribute (like CharTermAttribute's char[] buffer),
// you should make a copy if you need persistent access to the bytes, otherwise they will
// be rewritten across calls to IncrementToken()
DoSomethingWith(new BytesRef(bytes));
}
}
...
@lucene.experimental this is a very expert API, please use
Char
Inherited Members
Namespace: Lucene.Net.Analysis.TokenAttributes
Assembly: Lucene.Net.dll
Syntax
public interface ITermToBytesRefAttribute : IAttribute
Properties
| Improve this Doc View SourceBytesRef
Retrieve this attribute's Bytes
Declaration
BytesRef BytesRef { get; }
Property Value
Type | Description |
---|---|
Bytes |
this IAttributes internal Bytes |
Methods
| Improve this Doc View SourceFillBytesRef()
Updates the bytes Bytes
Declaration
void FillBytesRef()