diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene70/IndexedDISICache.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene70/IndexedDISICache.java index fdf93cf43e1..80867a3fa3a 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene70/IndexedDISICache.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene70/IndexedDISICache.java @@ -118,7 +118,9 @@ public class IndexedDISICache implements Accountable { this.name = ""; } - // Used to represent no caching. + /** + * Shared between all structures that are too small to meaningfully use jump-tables. + */ public static final IndexedDISICache EMPTY = new IndexedDISICache(); /** @@ -156,6 +158,10 @@ public class IndexedDISICache implements Accountable { return target >> RANK_BLOCK_BITS << RANK_BLOCK_BITS; } + /** + * Offsets stated the block starts. + * @return true if the cache has offsets. + */ public boolean hasOffsets() { return blockCache != null; } @@ -299,6 +305,7 @@ public class IndexedDISICache implements Accountable { } /** + * Creation stats intended for human inspection. * @return Human readable details from the creation of the cache instance. */ public String getCreationStats() { @@ -306,6 +313,7 @@ public class IndexedDISICache implements Accountable { } /** + * Cache name, as stated in the constructor. * @return Human-readable name for the cache instance. */ public String getName() { diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene70/IndexedDISICacheFactory.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene70/IndexedDISICacheFactory.java index 610529abf6f..f177210c17c 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene70/IndexedDISICacheFactory.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene70/IndexedDISICacheFactory.java @@ -47,6 +47,12 @@ public class IndexedDISICacheFactory implements Accountable { // jump-table for numerics with variable bits per value (dates, longs...) private final Map vBPVPool = new HashMap<>(); + /** + * Creates a {@link IndexedDISICache} and {@link VaryingBPVJumpTable} holding factory, + * intended for shared use within a single segment. + */ + public IndexedDISICacheFactory() { } + /** * Create a cached {@link IndexedDISI} instance. * @param data persistent data containing the DISI-structure. @@ -146,13 +152,24 @@ public class IndexedDISICacheFactory implements Accountable { return cache; } - // Statistics + /** + * Cache statistics intended for external inspection. + * @return the number of total blocks where jumps are accelerated by jump-tables. + */ public long getDISIBlocksWithOffsetsCount() { return disiPool.values().stream().filter(IndexedDISICache::hasOffsets).count(); } + /** + * Cache statistics intended for external inspection. + * @return the total number of DENSE blocks where index-counts are accelerated by rank. + */ public long getDISIBlocksWithRankCount() { return disiPool.values().stream().filter(IndexedDISICache::hasRank).count(); } + /** + * Cache statistics intended for external inspection. + * @return the number of numeric blocks where jumps are accelerated by jump-tables + */ public long getVaryingBPVCount() { return vBPVPool.size(); } diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene70/LongCompressor.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene70/LongCompressor.java index 1c030a7887b..7b12cc67935 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene70/LongCompressor.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene70/LongCompressor.java @@ -47,6 +47,11 @@ public class LongCompressor { */ private static final double DEFAULT_MIN_ZERO_VALUES_FRACTION_FOR_SPARSE = 0.2; // 20% (just guessing of a value here) + /** + * LongCompressor exclusively uses static methods and is never instantiated. + */ + private LongCompressor() { } + /** * Create a compact version of the given values. * @param values PackedInts with no special constraints. @@ -63,7 +68,7 @@ public class LongCompressor { * @return a compact version of the given values or the given values if compression did not improve on heap overhead. */ public static PackedInts.Reader compress(PackedInts.Reader values, int length) { - return compress(values, values.size(), true); + return compress(values, length, true); } /**