Class FieldMetadata

  • All Implemented Interfaces:
    Accountable

    public class FieldMetadata
    extends java.lang.Object
    implements Accountable
    Metadata and stats for one field in the index.

    There is only one instance of FieldMetadata per FieldInfo.

    • Field Detail

      • BASE_RAM_USAGE

        private static final long BASE_RAM_USAGE
      • fieldInfo

        protected final FieldInfo fieldInfo
      • isMutable

        protected final boolean isMutable
      • sumDocFreq

        protected int sumDocFreq
      • numTerms

        protected int numTerms
      • sumTotalTermFreq

        protected int sumTotalTermFreq
      • docCount

        protected int docCount
      • dictionaryStartFP

        protected long dictionaryStartFP
      • firstBlockStartFP

        protected long firstBlockStartFP
      • lastBlockStartFP

        protected long lastBlockStartFP
    • Constructor Detail

      • FieldMetadata

        public FieldMetadata​(FieldInfo fieldInfo,
                             int maxDoc)
        Constructs a FieldMetadata used for writing the index. This FieldMetadata is mutable.
        Parameters:
        maxDoc - The total number of documents in the segment being written.
      • FieldMetadata

        public FieldMetadata​(FieldInfo fieldInfo,
                             int maxDoc,
                             boolean isMutable)
      • FieldMetadata

        public FieldMetadata​(FieldInfo fieldInfo,
                             int maxDoc,
                             boolean isMutable,
                             long firstBlockStartFP,
                             long lastBlockStartFP,
                             BytesRef lastTerm)
        Parameters:
        isMutable - Set true if this FieldMetadata is created for writing the index. Set false if it is used for reading the index.
    • Method Detail

      • updateStats

        public void updateStats​(BlockTermState state)
        Updates the field stats with the given BlockTermState for the current block line (for one term).
      • getFieldInfo

        public FieldInfo getFieldInfo()
      • getSumDocFreq

        public int getSumDocFreq()
      • getNumTerms

        public int getNumTerms()
      • getSumTotalTermFreq

        public int getSumTotalTermFreq()
      • getDocCount

        public int getDocCount()
      • getFirstBlockStartFP

        public long getFirstBlockStartFP()
        Returns:
        The file pointer to the start of the first block of the field.
      • setFirstBlockStartFP

        public void setFirstBlockStartFP​(long firstBlockStartFP)
        Sets the file pointer to the start of the first block of the field.
      • getLastBlockStartFP

        public long getLastBlockStartFP()
        Returns:
        The start file pointer for the last block of the field.
      • setLastBlockStartFP

        public void setLastBlockStartFP​(long lastBlockStartFP)
        Sets the file pointer after the end of the last block of the field.
      • getDictionaryStartFP

        public long getDictionaryStartFP()
        Returns:
        The file pointer to the start of the dictionary of the field.
      • setDictionaryStartFP

        public void setDictionaryStartFP​(long dictionaryStartFP)
        Sets the file pointer to the start of the dictionary of the field.
      • setLastTerm

        public void setLastTerm​(BytesRef lastTerm)
      • getLastTerm

        public BytesRef getLastTerm()
      • ramBytesUsed

        public long ramBytesUsed()
        Description copied from interface: Accountable
        Return the memory usage of this object in bytes. Negative values are illegal.
        Specified by:
        ramBytesUsed in interface Accountable
      • write

        public void write​(DataOutput output)
                   throws java.io.IOException
        Throws:
        java.io.IOException