Package org.apache.lucene.util
Some utility classes.
-
Interface Summary Interface Description Attribute Base interface for attributes.AttributeReflector This interface is used to reflect contents ofAttributeSource
orAttributeImpl
.Bits Interface for Bitset-like structures.BytesRefIterator A simple iterator interface forBytesRef
iteration.MutableBits Extension of Bits for live documents.NamedSPILoader.NamedSPI Interface to supportNamedSPILoader.lookup(String)
by name.RollingBuffer.Resettable Implement to reset an instance -
Class Summary Class Description ArrayUtil Methods for manipulating arrays.AttributeImpl Base class for Attributes that can be added to aAttributeSource
.AttributeSource An AttributeSource contains a list of differentAttributeImpl
s, and methods to add and get them.AttributeSource.AttributeFactory An AttributeFactory creates instances ofAttributeImpl
s.AttributeSource.State This class holds the state of an AttributeSource.Bits.MatchAllBits Bits impl of the specified length with all bits set.Bits.MatchNoBits Bits impl of the specified length with no bits set.BitUtil A variety of high efficiency bit twiddling routines.BroadWord Methods and constants inspired by the article "Broadword Implementation of Rank/Select Queries" by Sebastiano Vigna, January 30, 2012: algorithm 1:BroadWord.bitCount(long)
, count of set bits in along
algorithm 2:BroadWord.select(long, int)
, selection of a set bit in along
, bytewise signed smaller <8 operator:BroadWord.smallerUpTo7_8(long,long)
.ByteBlockPool Class that Posting and PostingVector use to write byte streams into shared fixed-size byte[] arrays.ByteBlockPool.Allocator Abstract class for allocating and freeing byte blocks.ByteBlockPool.DirectAllocator A simpleByteBlockPool.Allocator
that never recycles.ByteBlockPool.DirectTrackingAllocator A simpleByteBlockPool.Allocator
that never recycles, but tracks how much total RAM is in use.BytesRef Represents byte[], as a slice (offset + length) into an existing byte[].BytesRefHash BytesRefHash
is a special purpose hash-map like data-structure optimized forBytesRef
instances.BytesRefHash.BytesStartArray Manages allocation of the per-term addresses.BytesRefHash.DirectBytesStartArray A simpleBytesRefHash.BytesStartArray
that tracks memory allocation using a privateCounter
instance.CharsRef Represents char[], as a slice (offset + length) into an existing char[].CloseableThreadLocal<T> Java's builtin ThreadLocal has a serious flaw: it can take an arbitrarily long amount of time to dereference the things you had stored in it, even once the ThreadLocal instance itself is no longer referenced.CollectionUtil Methods for manipulating (sorting) collections.CommandLineUtil Class containing some useful methods used by command line toolsConstants Some useful constants.Counter Simple counter classDocIdBitSet Simple DocIdSet and DocIdSetIterator backed by a BitSetDoubleBarrelLRUCache<K extends DoubleBarrelLRUCache.CloneableKey,V> Simple concurrent LRU cache, using a "double barrel" approach where two ConcurrentHashMaps record entries.DoubleBarrelLRUCache.CloneableKey Object providing clone(); the key class must subclass this.FieldCacheSanityChecker Provides methods for sanity checking that entries in the FieldCache are not wasteful or inconsistent.FieldCacheSanityChecker.Insanity Simple container for a collection of related CacheEntry objects that in conjunction with each other represent some "insane" usage of the FieldCache.FieldCacheSanityChecker.InsanityType An Enumeration of the different types of "insane" behavior that may be detected in a FieldCache.FilterIterator<T> AnIterator
implementation that filters elements with a boolean predicate.FixedBitSet BitSet of fixed length (numBits), backed by accessible (FixedBitSet.getBits()
) long[], accessed with an int index, implementingBits
andDocIdSet
.FixedBitSet.FixedBitSetIterator ADocIdSetIterator
which iterates over set bits in aFixedBitSet
.GrowableByteArrayDataOutput ADataOutput
that can be used to build a byte[].IndexableBinaryStringTools Deprecated. ImplementTermToBytesRefAttribute
and store bytes directly instead.InfoStream Debugging API for Lucene classes such asIndexWriter
andSegmentInfos
.InPlaceMergeSorter Sorter
implementation based on the merge-sort algorithm that merges in place (no extra memory will be allocated).IntBlockPool A pool for int blocks similar toByteBlockPool
IntBlockPool.Allocator Abstract class for allocating and freeing int blocks.IntBlockPool.DirectAllocator A simpleIntBlockPool.Allocator
that never recycles.IntBlockPool.SliceReader AIntBlockPool.SliceReader
that can read int slices written by aIntBlockPool.SliceWriter
IntBlockPool.SliceWriter AIntBlockPool.SliceWriter
that allows to write multiple integer slices into a givenIntBlockPool
.IntroSorter IntsRef Represents int[], as a slice (offset + length) into an existing int[].IOUtils This class emulates the new Java 7 "Try-With-Resources" statement.LongBitSet BitSet of fixed length (numBits), backed by accessible (LongBitSet.getBits()
) long[], accessed with a long index.LongsRef Represents long[], as a slice (offset + length) into an existing long[].LongValues Abstraction over an array of longs.MapOfSets<K,V> Helper class for keeping Lists of Objects associated with keys.MathUtil Math static utility methods.MergedIterator<T extends java.lang.Comparable<T>> Provides a merged sorted view from several sorted iterators.NamedSPILoader<S extends NamedSPILoader.NamedSPI> Helper class for loading named SPIs from classpath (e.g.NamedThreadFactory A defaultThreadFactory
implementation that accepts the name prefix of the created threads as a constructor argument.NumericUtils This is a helper class to generate prefix-encoded representations for numerical values and supplies converters to represent float/double values as sortable integers/longs.NumericUtils.IntRangeBuilder NumericUtils.LongRangeBuilder OpenBitSet An "open" BitSet implementation that allows direct access to the array of words storing the bits.OpenBitSetDISI OpenBitSet with added methods to bulk-update the bits from aDocIdSetIterator
.OpenBitSetIterator An iterator to iterate over set bits in an OpenBitSet.PagedBytes Represents a logical byte[] as a series of pages.PagedBytes.Reader Provides methods to read BytesRefs from a frozen PagedBytes.PForDeltaDocIdSet DocIdSet
implementation based on pfor-delta encoding.PForDeltaDocIdSet.Builder A builder forPForDeltaDocIdSet
.PrintStreamInfoStream InfoStream implementation over aPrintStream
such asSystem.out
.PriorityQueue<T> A PriorityQueue maintains a partial ordering of its elements such that the least element can always be found in constant time.QueryBuilder Creates queries from theAnalyzer
chain.RamUsageEstimator Estimates the size (memory representation) of Java objects.RecyclingByteBlockAllocator AByteBlockPool.Allocator
implementation that recycles unused byte blocks in a buffer and reuses them in subsequent calls toRecyclingByteBlockAllocator.getByteBlock()
.RecyclingIntBlockAllocator AIntBlockPool.Allocator
implementation that recycles unused int blocks in a buffer and reuses them in subsequent calls toRecyclingIntBlockAllocator.getIntBlock()
.RefCount<T> Manages reference counting for a given object.RollingBuffer<T extends RollingBuffer.Resettable> Acts like forever growing T[], but internally uses a circular buffer to reuse instances of T.SentinelIntSet A native int hash-based set where one value is reserved to mean "EMPTY" internally.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.SloppyMath Math functions that trade off accuracy for speed.SmallFloat Floating point numbers smaller than 32 bits.Sorter Base class for sorting algorithms implementations.SPIClassIterator<S> Helper class for loading SPI classes from classpath (META-INF files).StringHelper Methods for manipulating strings.TimSorter ToStringUtils Helper methods to ease implementingObject.toString()
.UnicodeUtil Class to encode java's UTF16 char[] into UTF8 byte[] without always allocating a new byte[] as String.getBytes("UTF-8") does.VirtualMethod<C> A utility for keeping backwards compatibility on previously abstract methods (or similar replacements).WAH8DocIdSet DocIdSet
implementation based on word-aligned hybrid encoding on words of 8 bits.WAH8DocIdSet.Builder A builder forWAH8DocIdSet
s.WeakIdentityMap<K,V> Implements a combination ofWeakHashMap
andIdentityHashMap
. -
Enum Summary Enum Description RamUsageEstimator.JvmFeature JVM diagnostic features.Version Use by certain classes to match version compatibility across releases of Lucene. -
Exception Summary Exception Description BytesRefHash.MaxBytesLengthExceededException SetOnce.AlreadySetException Thrown whenSetOnce.set(Object)
is called more than once.ThreadInterruptedException Thrown by lucene on detecting that Thread.interrupt() had been called.