Package-level declarations

Types

Link copied to clipboard
interface Accountable

An object whose RAM usage can be computed.

Link copied to clipboard

Helper methods for constructing nested resource descriptions and debugging RAM usage.

Link copied to clipboard
class ArrayUtil
Link copied to clipboard
interface Attribute

Base interface for attributes.

Link copied to clipboard
abstract class AttributeFactory
Link copied to clipboard

Base class for Attributes that can be added to a org.gnit.lucenekmp.util.AttributeSource.

Link copied to clipboard
fun interface AttributeReflector

This interface is used to reflect contents of AttributeSource or AttributeImpl.

Link copied to clipboard
open class AttributeSource

An AttributeSource contains a list of different AttributeImpls, and methods to add and get them. There can only be a single instance of an attribute in the same AttributeSource instance. This is ensured by passing in the actual type of the Attribute (Class) to the .addAttribute, which then checks if an instance of that type is already present. If yes, it returns the instance, otherwise it creates a new instance and returns it.

Link copied to clipboard
class BitDocIdSet(set: BitSet, cost: Long) : DocIdSet

Implementation of the DocIdSet interface on top of a BitSet.

Link copied to clipboard
interface Bits

Interface for Bitset-like structures.

Link copied to clipboard
abstract class BitSet : Bits, Accountable

Base implementation for a bit set.

Link copied to clipboard
open class BitSetIterator(bits: BitSet, cost: Long) : DocIdSetIterator

A DocIdSetIterator which iterates over set bits in a bit set.

Link copied to clipboard
object BitUtil

A variety of high efficiency bit twiddling routines and encoders for primitives.

Link copied to clipboard

This class enables the allocation of fixed-size buffers and their management as part of a buffer array. Allocation is done through the use of an Allocator which can be customized, e.g. to allow recycling old buffers. There are methods for writing (.append and reading from the buffers (e.g. .readBytes, which handle read/write operations across buffer boundaries.

Link copied to clipboard

Represents byte[], as a slice (offset + length) into an existing byte[]. The bytes property should never be null; use EMPTY_BYTES if necessary.

Link copied to clipboard

A simple append only random-access BytesRef array that stores full copies of the appended bytes in a ByteBlockPool.

Link copied to clipboard

Represents a logical list of ByteRef backed by a ByteBlockPool. It uses up to two bytes to record the length of the BytesRef followed by the actual bytes. They can be read using the start position returned when they are appended.

Link copied to clipboard

A builder for BytesRef instances.

Link copied to clipboard

Specialized BytesRef comparator that StringSorter has optimizations for.

Link copied to clipboard
class BytesRefHash(pool: ByteBlockPool, capacity: Int, bytesStartArray: BytesRefHash.BytesStartArray) : Accountable

BytesRefHash is a special purpose hash-map like data-structure optimized for [ ] instances. BytesRefHash maintains mappings of byte arrays to ids (Map) storing the hashed bytes efficiently in continuous storage. The mapping to the id is encapsulated inside BytesRefHash and is guaranteed to be increased for each added BytesRef.

Link copied to clipboard

A simple iterator interface for BytesRef iteration.

Link copied to clipboard
class CharsRef(var chars: CharArray, var offset: Int, len: Int) : Comparable<CharsRef> , CharSequence

Represents char[], as a slice (offset + length) into an existing char[]. The {@link #chars} member should never be null; use {@link #EMPTY_CHARS} if necessary.

Link copied to clipboard

A builder for CharsRef instances.

Link copied to clipboard

No-op classloader for Kotlin Multiplatform is used.

Link copied to clipboard
class ClasspathResourceLoader(clazz: KClass<*>? = null) : ResourceLoader

Simple ResourceLoader that resolves resources from the filesystem.

Link copied to clipboard
expect open class CloseableThreadLocal<T> : AutoCloseable

Thread-local storage with a close hook to release references.

Link copied to clipboard

Methods for manipulating (sorting) and creating collections. Sort methods work directly on the supplied lists and don't copy to/from arrays before/after. For medium size collections as used in the Lucene indexer that is much more efficient.

Link copied to clipboard

Class containing some useful methods used by command line tools

Link copied to clipboard
object Constants
Link copied to clipboard
abstract class Counter

Simple counter class

Link copied to clipboard

A DocIdSetIterator like BitSetIterator but has a doc base in order to avoid storing previous 0s.

Link copied to clipboard

A builder of DocIdSets. At first it uses a sparse structure to gather documents, and then upgrades to a non-sparse bit set once enough hits match.

Link copied to clipboard
class FileDeleter(directory: Directory, messenger: (FileDeleter.MsgType, String) -> Unit)

This class provides ability to track the reference counts of a set of index files and delete them when their counts decreased to 0.

Link copied to clipboard
abstract class FilterIterator<T, InnerT : T>(iterator: MutableIterator<InnerT>) : MutableIterator<T>

An Iterator implementation that filters elements with a boolean predicate.

Link copied to clipboard

BitSet of fixed length (numBits), backed by accessible (.getBits) long[], accessed with an int index, implementing Bits and DocIdSet. If you need to manage more than 2.1B bits, use LongBitSet.

Link copied to clipboard
class FrequencyTrackingRingBuffer(maxSize: Int, sentinel: Int) : Accountable

A ring buffer that tracks the frequency of the integers that it contains. This is typically useful to track the hash codes of popular recently-used items.

Link copied to clipboard

This class contains utility methods and constants for group varint

Link copied to clipboard
abstract class InfoStream : AutoCloseable

Debugging API for Lucene classes such as IndexWriter and SegmentInfos.

Link copied to clipboard
abstract class InPlaceMergeSorter : Sorter

Sorter implementation based on the merge-sort algorithm that merges in place (no extra memory will be allocated). Small arrays are sorted with binary sort.

Link copied to clipboard
class IntBlockPool @JvmOverloads constructor(allocator: IntBlockPool.Allocator = DirectAllocator())

A pool for int blocks similar to ByteBlockPool

Link copied to clipboard
abstract class IntroSelector : Selector

Adaptive selection algorithm based on the introspective quick select algorithm. The quick select algorithm uses an interpolation variant of Tukey's ninther median-of-medians for pivot, and Bentley-McIlroy 3-way partitioning. For the introspective protection, it shuffles the sub-range if the max recursive depth is exceeded.

Link copied to clipboard
abstract class IntroSorter : Sorter

Sorter implementation based on a variant of the quicksort algorithm called introsort: when the recursion level exceeds the log of the length of the array to sort, it falls back to heapsort. This prevents quicksort from running into its worst-case quadratic runtime. Selects the pivot using Tukey's ninther median-of-medians, and partitions using Bentley-McIlroy 3-way partitioning. Small ranges are sorted with insertion sort.

Link copied to clipboard

Represents int[], as a slice (offset + length) into an existing int[]. The .ints member should never be null; use .EMPTY_INTS if necessary.

Link copied to clipboard

A builder for IntsRef instances.

Link copied to clipboard
fun interface IOBooleanSupplier

Boolean supplier that is allowed to throw an IOException.

Link copied to clipboard
fun interface IOConsumer<T>

An I/O operation with a single input that can throw an IOException. (Functional interface)

Link copied to clipboard
fun interface IOFunction<T, R>

A Function that may throw an IOException (functional interface).

Link copied to clipboard
fun interface IORunnable

A Runnable that may throw an IOException

Link copied to clipboard
fun interface IOSupplier<T>

This is a result supplier that is allowed to throw an IOException.

Link copied to clipboard
object IOUtils
Link copied to clipboard

BitSet of fixed length (numBits), backed by accessible (.getBits) long[], accessed with a long index. Use it only if you intend to store more than 2.1B bits, otherwise you should use FixedBitSet.

Link copied to clipboard
class LongHeap(maxSize: Int)

A min heap that stores longs; a primitive priority queue that like all priority queues maintains a partial ordering of its elements such that the least element can always be found in constant time. Put()'s and pop()'s require log(size). This heap provides unbounded growth via .push, and bounded-size insertion based on its nominal maxSize via .insertWithOverflow. The heap is a min heap, meaning that the top element is the lowest value of the heap.

Link copied to clipboard

Represents long[], as a slice (offset + length) into an existing long[]. The .longs member should never be null; use .EMPTY_LONGS if necessary.

Link copied to clipboard
abstract class LongValues

Abstraction over an array of longs.

Link copied to clipboard

A LSB Radix sorter for unsigned int values.

Link copied to clipboard
object MathUtil

Math static utility methods.

Link copied to clipboard
class MergedIterator<T : Comparable<T>>(removeDuplicates: Boolean, iterators: Array<MutableIterator<T>>) : MutableIterator<T> , Iterable<T>

Provides a merged sorted view from several sorted iterators.

Link copied to clipboard
abstract class MSBRadixSorter : Sorter

Radix sorter for variable-length strings. This class sorts based on the most significant byte first and falls back to IntroSorter when the size of the buckets to sort becomes small.

Link copied to clipboard
class NamedSPILoader<S : NamedSPILoader.NamedSPI>(clazz: KClass<S>, classloader: ClassLoader? = null) : Iterable<S>

Helper class for loading named SPIs from classpath (e.g. Codec, PostingsFormat).

Link copied to clipboard
class NamedThreadFactory(threadNamePrefix: String?) : ThreadFactory

A default ThreadFactory implementation that accepts the name prefix of the created threads as a constructor argument. Otherwise, this factory yields the same semantics as the thread factory returned by Executors.defaultThreadFactory.

Link copied to clipboard

Low-overhead crash probe for kotlin/native fatal-signal diagnostics.

Link copied to clipboard
class NotDocIdSet(maxDoc: Int, in: DocIdSet) : DocIdSet

This DocIdSet encodes the negation of another DocIdSet. It is cacheable and supports random-access if the underlying set is cacheable and supports random-access.

Link copied to clipboard

Helper APIs to encode numeric values as sortable bytes and vice-versa.

Link copied to clipboard
open class OfflineSorter(dir: Directory, tempFileNamePrefix: String, comparator: Comparator<BytesRef>, ramBufferSize: OfflineSorter.BufferSize, maxTempFiles: Int, valueLength: Int, exec: ExecutorService?, maxPartitionsInRAM: Int)

On-disk sorting of byte arrays.

Link copied to clipboard
class PagedBytes(blockBits: Int) : Accountable

Represents a logical byte[] as a series of pages. You can write-once into the logical byte[] (append only), using copy, and then retrieve slices (BytesRef) into it using fill.

Link copied to clipboard
open class PrintStreamInfoStream(stream: PrintStream, messageID: Int = MESSAGE_ID.fetchAndIncrement()) : InfoStream

InfoStream implementation over a PrintStream such as System.out.

Link copied to clipboard
expect abstract class PriorityQueue<T>(maxSize: Int, sentinelObjectSupplier: () -> T? = { null }) : Iterable<T>
Link copied to clipboard
open class QueryBuilder(var analyzer: Analyzer = StandardAnalyzer())

Creates queries from the Analyzer chain.

Link copied to clipboard
abstract class RadixSelector : Selector

Radix selector.

Link copied to clipboard

Estimates the size (memory representation) of Java objects.

Link copied to clipboard

Simplified version of Lucene's RamUsageTester.

Link copied to clipboard

A ByteBlockPool.Allocator implementation that recycles unused byte blocks in a buffer and reuses them in subsequent calls to .byteBlock.

Link copied to clipboard

A IntBlockPool.Allocator implementation that recycles unused int blocks in a buffer and reuses them in subsequent calls to .intBlock.

Link copied to clipboard
open class RefCount<T>(object: T?)

Manages reference counting for a given object. Extensions can override .release to do custom logic when reference counting hits 0.

Link copied to clipboard
interface ResourceLoader

Abstraction for loading resources (streams, files, and classes).

Link copied to clipboard

Implemented by analysis factories that need access to external resources.

Link copied to clipboard

DocIdSet implementation inspired from http://roaringbitmap.org/

Link copied to clipboard

Simplified port of Lucene's RollingBuffer. Acts like a growable T[] with reuse of instances.

Link copied to clipboard

An ExecutorService that executes tasks immediately in the calling thread during submit.

Link copied to clipboard
abstract class Selector

An implementation of a selection algorithm, ie. computing the k-th greatest value from a collection.

Link copied to clipboard
open class SentinelIntSet(size: Int, val emptyVal: Int)

A native int hash-based set where one value is reserved to mean "EMPTY" internally. The space overhead is fairly low as there is only one power-of-two sized int[] to hold the values. The set is re-hashed when adding a value that would make it >= 75% full. Consider extending and over-riding hash if the values might be poor hash keys; Lucene docids should be fine. The internal fields are exposed publicly to enable more efficient use at the expense of better O-O principles.

Link copied to clipboard
class SetOnce<T : Any> : Cloneable<SetOnce<T>>

A convenient class which offers a semi-immutable object wrapper implementation which allows one to set the value of an object exactly once, and retrieve it many times. If .set is called more than once, AlreadySetException is thrown and the operation will fail.

Link copied to clipboard
object SloppyMath

Math functions that trade off accuracy for speed.

Link copied to clipboard
object SmallFloat

Floating point numbers smaller than 32 bits.

Link copied to clipboard
Link copied to clipboard
abstract class Sorter

Base class for sorting algorithms implementations.

Link copied to clipboard
class SparseFixedBitSet(length: Int) : BitSet

A bit set that only stores longs that have at least one bit which is set. The way it works is that the space of bits is divided into blocks of 4096 bits, which is 64 longs. Then for each block, we have:

Link copied to clipboard
abstract class StableMSBRadixSorter(maxLength: Int) : MSBRadixSorter

Stable radix sorter for variable-length strings.

Link copied to clipboard

Methods for manipulating strings.

Link copied to clipboard
abstract class StringSorter : Sorter

A BytesRef sorter tries to use a efficient radix sorter if StringSorter.cmp is a BytesRefComparator, otherwise fallback to StringSorter.fallbackSorter

Link copied to clipboard

Thrown by lucene on detecting that Thread.interrupt() had been called. Unlike Java's InterruptedException, this exception is not checked..

Link copied to clipboard
abstract class TimSorter : Sorter

Sorter implementation based on the TimSort algorithm. It sorts small arrays with a binary sort.

Link copied to clipboard

Helper methods to ease implementing Object.toString.

Link copied to clipboard

Class to encode java's UTF16 char[] into UTF8 byte[] without always allocating a new byte[] as String.getBytes(StandardCharsets.UTF_8) does.

Link copied to clipboard
interface Unwrappable<T>

An object with this interface is a wrapper around another object (e.g., a filter with a delegate). The method .unwrap can be called to get the wrapped object

Link copied to clipboard
object VectorUtil

Utilities for computations with numeric arrays, especially algebraic operations like vector dot products. This class uses SIMD vectorization if the corresponding Java module is available and enabled. To enable vectorized code, pass --add-modules jdk.incubator.vector to Java's command line.

Link copied to clipboard
class Version

Use by certain classes to match version compatibility across releases of Lucene.

Link copied to clipboard
class VirtualMethod<C : Any>(baseClass: KClass<C>, method: String, parameters: KClass<*>)

Minimal common-code port of Lucene's VirtualMethod.

Functions

Link copied to clipboard
fun String.codePointCount(start: Int = 0, end: Int = length): Int
Link copied to clipboard

Returns a sequence of Unicode code point values from this string.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun ByteArray.getIntBE(offset: Int): Int

Reads 4 bytes in big-endian order from this ByteArray starting at the given offset.

Link copied to clipboard
fun ByteArray.getIntLE(offset: Int): Int

Reads 4 bytes in little-endian order from this ByteArray starting at the given offset.

fun ByteArray.getIntLE(offset: Int, value: Int): Int

Writes value as a little-endian short into this ByteArray at the specified offset.

Link copied to clipboard
inline fun getLogger(): KLogger
Link copied to clipboard
fun ByteArray.getLongBE(offset: Int): Long

Reads 8 bytes in big-endian order from this ByteArray starting at the given offset.

Link copied to clipboard
fun ByteArray.getLongLE(offset: Int): Long

Reads 8 bytes in little-endian order from this ByteArray starting at the given offset.

Link copied to clipboard

Reads 2 bytes from this ByteArray in big-endian order, starting at offset, and returns the result as a Short.

Link copied to clipboard

Reads 2 bytes in little-endian order from this ByteArray starting at the given offset.

Link copied to clipboard
Link copied to clipboard
fun ByteArray.putIntLE(offset: Int, value: Int)

Writes a 32-bit integer into the byte array at the given offset in little-endian order.

Link copied to clipboard
fun ByteArray.putIntLEPartial(offset: Int, value: Int, numBytes: Int)

Writes the lowest numBytes bytes of the value into the ByteArray in little‑endian order, starting at offset.

Link copied to clipboard
fun ByteArray.putLongLE(offset: Int, value: Long)

Writes value as a little-endian long into this ByteArray at the specified offset.

Link copied to clipboard
fun ByteArray.putShortLE(offset: Int, value: Short)

Writes value as a little-endian short into this ByteArray at the specified offset.

Link copied to clipboard
fun ByteArray.setIntBE(offset: Int, value: Int)

Sets a 32-bit integer into this ByteArray in big-endian order.

Link copied to clipboard
fun ByteArray.setIntLE(offset: Int, value: Int)

Writes value as a little-endian int into this ByteArray at the specified offset.

Link copied to clipboard
fun ByteArray.setLongBE(offset: Int, value: Long)

Sets a 64-bit long into this ByteArray in big-endian order.

Link copied to clipboard
fun ByteArray.setLongLE(offset: Int, value: Long)

Writes a 64-bit long into the byte array at the given offset in little-endian order.

Link copied to clipboard
fun ByteArray.setShortBE(offset: Int, value: Short)

Writes value as a big-endian short into this ByteArray at the specified offset.

Link copied to clipboard
fun ByteArray.setShortLE(offset: Int, value: Short)

Writes a 16-bit short into the byte array at the given offset in little-endian order.

Link copied to clipboard
expect fun <T> withCheckpointCallPathHint(block: () -> T): T
Link copied to clipboard
fun <T> withCurrentCallPathHint(className: String, methodName: String, block: () -> T): T
Link copied to clipboard
expect fun <T> withIndexingChainCallPathHint(block: () -> T): T
Link copied to clipboard
expect fun <T> withIndexingChainFlushCallPathHint(block: () -> T): T
Link copied to clipboard
expect fun <T> withPerFieldInvertCallPathHint(block: () -> T): T
Link copied to clipboard
expect fun <T> withReadOnlyCloneCallPathHint(block: () -> T): T