Home » lucene-3.0.1-src » org.apache » lucene » document » [javadoc | source]
org.apache.lucene.document
public interface: Fieldable [javadoc | source]

All Implemented Interfaces:
    java$io$Serializable

All Known Implementing Classes:
    AbstractField, Field, NumericField, LazyField

Synonymous with Field .

WARNING: This interface may change within minor versions, despite Lucene's backward compatibility requirements. This means new methods may be added from version to version. This change only affects the Fieldable API; other backwards compatibility promises remain intact. For example, Lucene can still read and write indices created within the same major version.

Method from org.apache.lucene.document.Fieldable Summary:
getBinaryLength,   getBinaryOffset,   getBinaryValue,   getBinaryValue,   getBoost,   getOmitNorms,   getOmitTermFreqAndPositions,   isBinary,   isIndexed,   isLazy,   isStoreOffsetWithTermVector,   isStorePositionWithTermVector,   isStored,   isTermVectorStored,   isTokenized,   name,   readerValue,   setBoost,   setOmitNorms,   setOmitTermFreqAndPositions,   stringValue,   tokenStreamValue
Method from org.apache.lucene.document.Fieldable Detail:
 abstract public int getBinaryLength()
    Returns length of byte[] segment that is used as value, if Field is not binary returned value is undefined
 abstract public int getBinaryOffset()
    Returns offset into byte[] segment that is used as value, if Field is not binary returned value is undefined
 abstract public byte[] getBinaryValue()
    Return the raw byte[] for the binary field. Note that you must also call #getBinaryLength and #getBinaryOffset to know which range of bytes in this returned array belong to the field.
 abstract public byte[] getBinaryValue(byte[] result)
    Return the raw byte[] for the binary field. Note that you must also call #getBinaryLength and #getBinaryOffset to know which range of bytes in this returned array belong to the field.

    About reuse: if you pass in the result byte[] and it is used, likely the underlying implementation will hold onto this byte[] and return it in future calls to #getBinaryValue() . So if you subsequently re-use the same byte[] elsewhere it will alter this Fieldable's value.

 public float getBoost()
 public boolean getOmitNorms()
    True if norms are omitted for this indexed field
 public boolean getOmitTermFreqAndPositions()
 public boolean isBinary()
    True if the value of the field is stored as binary
 public boolean isIndexed()
    True if the value of the field is to be indexed, so that it may be searched on.
 public boolean isLazy()
 public boolean isStoreOffsetWithTermVector()
    True if terms are stored as term vector together with their offsets (start and end positon in source text).
 public boolean isStorePositionWithTermVector()
    True if terms are stored as term vector together with their token positions.
 public boolean isStored()
    True if the value of the field is to be stored in the index for return with search hits.
 public boolean isTermVectorStored()
    True if the term or terms used to index this field are stored as a term vector, available from org.apache.lucene.index.IndexReader#getTermFreqVector(int,String) . These methods do not provide access to the original content of the field, only to terms used to index it. If the original content must be preserved, use the stored attribute instead.
 public boolean isTokenized()
    True if the value of the field should be tokenized as text prior to indexing. Un-tokenized fields are indexed as a single word and may not be Reader-valued.
 public String name()
    Returns the name of the field as an interned string. For example "date", "title", "body", ...
 public Reader readerValue()
    The value of the field as a Reader, which can be used at index time to generate indexed tokens.
 public  void setBoost(float boost)
 public  void setOmitNorms(boolean omitNorms)
    Expert: If set, omit normalization factors associated with this indexed field. This effectively disables indexing boosts and length normalization for this field.
 public  void setOmitTermFreqAndPositions(boolean omitTermFreqAndPositions)
    Expert: If set, omit term freq, positions and payloads from postings for this field.

    NOTE: While this option reduces storage space required in the index, it also means any query requiring positional information, such as PhraseQuery or SpanQuery subclasses will silently fail to find results.

 public String stringValue()
    The value of the field as a String, or null.

    For indexing, if isStored()==true, the stringValue() will be used as the stored field value unless isBinary()==true, in which case getBinaryValue() will be used. If isIndexed()==true and isTokenized()==false, this String value will be indexed as a single token. If isIndexed()==true and isTokenized()==true, then tokenStreamValue() will be used to generate indexed tokens if not null, else readerValue() will be used to generate indexed tokens if not null, else stringValue() will be used to generate tokens.

 public TokenStream tokenStreamValue()
    The TokenStream for this field to be used when indexing, or null.