org.apache.lucene.index

Class LogByteSizeMergePolicy

    • Constructor Detail

      • LogByteSizeMergePolicy

        public LogByteSizeMergePolicy()
        Sole constructor, setting all settings to their defaults.
    • Method Detail

      • setMaxMergeMB

        public void setMaxMergeMB(double mb)

        Determines the largest segment (measured by total byte size of the segment's files, in MB) that may be merged with other segments. Small values (e.g., less than 50 MB) are best for interactive indexing, as this limits the length of pauses while indexing to a few seconds. Larger values are best for batched indexing and speedier searches.

        Note that LogMergePolicy.setMaxMergeDocs(int) is also used to check whether a segment is too large for merging (it's either or).

      • getMaxMergeMB

        public double getMaxMergeMB()
        Returns the largest segment (measured by total byte size of the segment's files, in MB) that may be merged with other segments.
        See Also:
        setMaxMergeMB(double)
      • setMaxMergeMBForForcedMerge

        public void setMaxMergeMBForForcedMerge(double mb)

        Determines the largest segment (measured by total byte size of the segment's files, in MB) that may be merged with other segments during forceMerge. Setting it low will leave the index with more than 1 segment, even if IndexWriter.forceMerge(int) is called.

      • setMinMergeMB

        public void setMinMergeMB(double mb)
        Sets the minimum size for the lowest level segments. Any segments below this size are considered to be on the same level (even if they vary drastically in size) and will be merged whenever there are mergeFactor of them. This effectively truncates the "long tail" of small segments that would otherwise be created into a single level. If you set this too large, it could greatly increase the merging cost during indexing (if you flush many small segments).