jruby/docs BETA
Navigation
org.apache.lucene.analysis.tokenattributes 24
I BytesTermAttribute
C BytesTermAttributeImpl
I CharTermAttribute
C CharTermAttributeImpl
I FlagsAttribute
C FlagsAttributeImpl
I KeywordAttribute
C KeywordAttributeImpl
I OffsetAttribute
C OffsetAttributeImpl
C PackedTokenAttributeImpl
I PayloadAttribute
C PayloadAttributeImpl
I PositionIncrementAttribute
C PositionIncrementAttributeImpl
I PositionLengthAttribute
C PositionLengthAttributeImpl
I SentenceAttribute
C SentenceAttributeImpl
I TermFrequencyAttribute
C TermFrequencyAttributeImpl
I TermToBytesRefAttribute
I TypeAttribute
C TypeAttributeImpl
TermToBytesRefAttribute — members 1
M bytes_ref() BytesRef

org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute

interface abstract implements Attribute 1 members

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 #getBytesRef() for each term. Example:

  final TermToBytesRefAttribute termAtt = tokenStream.getAttribute(TermToBytesRefAttribute.class);

  while (tokenStream.incrementToken() {
    final BytesRef bytes = termAtt.getBytesRef();

    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(BytesRef.deepCopyOf(bytes));
    }
  }
  ...

Instance Methods

bytes_ref

BytesRef bytes_ref ( )
Java: getBytesRef() · also: get_bytes_ref

Retrieve this attribute's BytesRef. The bytes are updated from the current term. The implementation may return a new instance or keep the previous one.

Returns: a BytesRef to be indexed (only stays valid until token stream gets incremented)

this work for additional information regarding copyright ownership.