Class Lucene90CompressingTermVectorsWriter

    • Constructor Detail

      • Lucene90CompressingTermVectorsWriter

        Lucene90CompressingTermVectorsWriter​(Directory directory,
                                             SegmentInfo si,
                                             java.lang.String segmentSuffix,
                                             IOContext context,
                                             java.lang.String formatName,
                                             CompressionMode compressionMode,
                                             int chunkSize,
                                             int maxDocsPerChunk,
                                             int blockShift)
                                      throws java.io.IOException
        Sole constructor.
        Throws:
        java.io.IOException
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class TermVectorsWriter
        Throws:
        java.io.IOException
      • finishDocument

        public void finishDocument()
                            throws java.io.IOException
        Description copied from class: TermVectorsWriter
        Called after a doc and all its fields have been added.
        Overrides:
        finishDocument in class TermVectorsWriter
        Throws:
        java.io.IOException
      • finishField

        public void finishField()
                         throws java.io.IOException
        Description copied from class: TermVectorsWriter
        Called after a field and all its terms have been added.
        Overrides:
        finishField in class TermVectorsWriter
        Throws:
        java.io.IOException
      • addPosition

        public void addPosition​(int position,
                                int startOffset,
                                int endOffset,
                                BytesRef payload)
                         throws java.io.IOException
        Description copied from class: TermVectorsWriter
        Adds a term position and offsets
        Specified by:
        addPosition in class TermVectorsWriter
        Throws:
        java.io.IOException
      • triggerFlush

        private boolean triggerFlush()
      • flush

        private void flush​(boolean force)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • flushNumFields

        private int flushNumFields​(int chunkDocs)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • flushFieldNums

        private int[] flushFieldNums()
                              throws java.io.IOException
        Returns a sorted array containing unique field numbers
        Throws:
        java.io.IOException
      • flushFields

        private void flushFields​(int totalFields,
                                 int[] fieldNums)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • flushFlags

        private void flushFlags​(int totalFields,
                                int[] fieldNums)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • flushNumTerms

        private void flushNumTerms​(int totalFields)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • flushTermLengths

        private void flushTermLengths()
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • flushTermFreqs

        private void flushTermFreqs()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • flushPositions

        private void flushPositions()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • flushOffsets

        private void flushOffsets​(int[] fieldNums)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • flushPayloadLengths

        private void flushPayloadLengths()
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • finish

        public void finish​(int numDocs)
                    throws java.io.IOException
        Description copied from class: TermVectorsWriter
        Called before TermVectorsWriter.close(), passing in the number of documents that were written. Note that this is intentionally redundant (equivalent to the number of calls to TermVectorsWriter.startDocument(int), but a Codec should check that this is the case to detect the JRE bug described in LUCENE-1282.
        Specified by:
        finish in class TermVectorsWriter
        Throws:
        java.io.IOException
      • addProx

        public void addProx​(int numProx,
                            DataInput positions,
                            DataInput offsets)
                     throws java.io.IOException
        Description copied from class: TermVectorsWriter
        Called by IndexWriter when writing new segments.

        This is an expert API that allows the codec to consume positions and offsets directly from the indexer.

        The default implementation calls TermVectorsWriter.addPosition(int, int, int, BytesRef), but subclasses can override this if they want to efficiently write all the positions, then all the offsets, for example.

        NOTE: This API is extremely expert and subject to change or removal!!!

        Overrides:
        addProx in class TermVectorsWriter
        Throws:
        java.io.IOException
      • tooDirty

        boolean tooDirty​(Lucene90CompressingTermVectorsReader candidate)
        Returns true if we should recompress this reader, even though we could bulk merge compressed data

        The last chunk written for a segment is typically incomplete, so without recompressing, in some worst-case situations (e.g. frequent reopen with tiny flushes), over time the compression ratio can degrade. This is a safety switch.

      • canPerformBulkMerge

        private boolean canPerformBulkMerge​(MergeState mergeState,
                                            MatchingReaders matchingReaders,
                                            int readerIndex)
      • ramBytesUsed

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

        public java.util.Collection<Accountable> getChildResources()
        Description copied from interface: Accountable
        Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).
        See Also:
        Accountables