Package-level declarations

Types

Link copied to clipboard

AbstractKnnCollector is the default implementation for a knn collector used for gathering kNN results and providing topDocs from the gathered neighbors

Link copied to clipboard
abstract class AbstractKnnVectorQuery(val field: String, val k: Int, val filter: Query?, searchStrategy: KnnSearchStrategy) : Query

Uses KnnVectorsReader.search to perform nearest neighbour search.

Contains functionality common to both MultiTermQueryConstantScoreBlendedWrapper and MultiTermQueryConstantScoreWrapper. Internal implementation detail only. Not meant as an extension point for users.

Link copied to clipboard
abstract class AbstractVectorSimilarityQuery(val field: String, traversalSimilarity: Float, resultSimilarity: Float, filter: Query?) : Query

Search for all (approximate) vectors above a similarity threshold.

Link copied to clipboard
open class AutomatonQuery(term: Term, automaton: Automaton, isBinary: Boolean = false, rewriteMethod: MultiTermQuery.RewriteMethod = CONSTANT_SCORE_BLENDED_REWRITE) : MultiTermQuery, Accountable

A Query that will match terms against a finite-state machine.

Link copied to clipboard

A Query that blends index statistics across multiple terms. This is particularly useful when several terms should produce identical scores, regardless of their index statistics.

Link copied to clipboard
data class BooleanClause(val query: Query, val occur: BooleanClause.Occur)

A clause in a BooleanQuery.

Link copied to clipboard

A Query that matches documents matching boolean combinations of other queries, e.g. [ ]s, PhraseQuerys or other BooleanQuerys.

Link copied to clipboard

Add this Attribute to a TermsEnum returned by and update the boost on each returned term. This enables to control the boost factor for each matching term in or TopTermsRewrite mode. FuzzyQuery is using this to take the edit distance into account.

Link copied to clipboard
Link copied to clipboard
class BoostQuery(query: Query, boost: Float) : Query

A Query wrapper that allows to give a boost to the wrapped query. Boost values that are less than one will give less importance to this query compared to other ones while values that are greater than one will give more importance to the scores returned by this query.

Link copied to clipboard
abstract class BulkScorer

This class is used to score a range of documents at once, and is returned by . Only queries that have a more optimized means of scoring across a range of documents need to override this. Otherwise, a default implementation is wrapped around the [ ] returned by Weight.scorer.

Link copied to clipboard
open class ByteVectorSimilarityQuery(field: String, target: ByteArray, traversalSimilarity: Float, resultSimilarity: Float, filter: Query? = null) : AbstractVectorSimilarityQuery

Search for all (approximate) byte vectors above a similarity threshold.

Link copied to clipboard

Caches all docs, and optionally also scores, coming from a search, and is then able to replay them to another collector. You specify the max RAM this class may use. Once the collection is done, call isCached. If this returns true, you can use replay against a new collector. If it returns false, this means too much RAM was required and you must instead re-run the original search.

Link copied to clipboard
fun interface CheckedIntConsumer<T : Exception>

Like IntConsumer, but may throw checked exceptions.

Link copied to clipboard
data class CollectionStatistics(val field: String?, val maxDoc: Long, val docCount: Long, val sumTotalTermFreq: Long, val sumDocFreq: Long)

Contains statistics for a collection (field).

Link copied to clipboard

Throw this exception in LeafCollector.collect to prematurely terminate collection of the current leaf.

Link copied to clipboard
interface Collector

Expert: Collectors are primarily meant to be used to gather raw results from a search, and implement sorting or custom result filtering, collation, etc.

Link copied to clipboard

A manager of collectors. This class is useful to parallelize execution of search requests and has two main methods:

Link copied to clipboard

A Query that treats multiple fields as a single stream and scores terms as if they had been indexed in a single field whose values would be the union of the values of the provided fields.

Link copied to clipboard

Helper methods for building conjunction iterators

Link copied to clipboard
open class ConstantScoreQuery(val query: Query) : Query

A query that wraps another query and simply returns a constant score equal to 1 for every document that matches the query. It therefore simply strips of all scores and always returns 1.

Link copied to clipboard

A constant-scoring Scorer.

Link copied to clipboard

Specialization of ScorerSupplier for queries that produce constant scores.

Link copied to clipboard
abstract class ConstantScoreWeight : Weight

A Weight that has a constant score equal to the boost of the wrapped query. This is typically useful when building queries which do not produce meaningful scores and are mostly useful for filtering.

Link copied to clipboard
open class ControlledRealTimeReopenThread<T>(writer: IndexWriter, manager: ReferenceManager<T>, targetMaxStaleSec: Double, targetMinStaleSec: Double) : Thread, Closeable

Utility class that runs a thread to manage periodicc reopens of a ReferenceManager, with methods to wait for a specific index changes to become visible. When a given search request needs to see a specific index change, call the {#waitForGeneration} to wait for that change to be visible. Note that this will only scale well if most searches do not need to wait for a specific index generation.

Link copied to clipboard

A priority queue of DocIdSetIterators that orders by current doc ID. This specialization is needed over PriorityQueue because the pluggable comparison function makes the rebalancing quite slow.

Link copied to clipboard
open class DisiWrapper(scorer: Scorer, impacts: Boolean)

Wrapper used in DisiPriorityQueue.

Link copied to clipboard

A DocIdSetIterator which is a disjunction of the approximations of the provided iterators.

Link copied to clipboard
open class DisjunctionMaxQuery(disjuncts: MutableCollection<out Query>, tieBreakerMultiplier: Float) : Query, Iterable<Query>

A query that generates the union of documents produced by its subqueries, and that scores each document with the maximum score for that document as produced by any subquery, plus a tie breaking increment for any additional matching subqueries. This is useful when searching for a word in multiple fields with different boost factors (so that the fields cannot be combined equivalently into a single search field). We want the primary score to be the one associated with the highest boost, not the sum of the field scores (as BooleanQuery would give). If the query is "albino elephant" this ensures that "albino" matching one field and "elephant" matching another gets a higher score than "albino" matching both fields. To get this result, use both BooleanQuery and DisjunctionMaxQuery: for each term a DisjunctionMaxQuery searches for it in each field, while the set of these DisjunctionMaxQuery's is combined into a BooleanQuery. The tie breaker capability allows results that include the same term in multiple fields to be judged better than results that include this term in only the best of those multiple fields, without confusing this with the better case of two different terms in the multiple fields.

Link copied to clipboard
abstract class DocIdSet : Accountable

A DocIdSet contains a set of doc ids. Implementing classes must only implement .iterator to provide access to the set.

Link copied to clipboard
abstract class DocIdSetIterator

This abstract class defines methods to iterate over a set of non-decreasing doc ids. Note that this class assumes it iterates on doc Ids, and therefore .NO_MORE_DOCS is set to {@value

Link copied to clipboard
abstract class DocIdStream

A stream of doc IDs. Most methods on DocIdStreams are terminal, meaning that the [ ] may not be further used.

Link copied to clipboard
class DocValuesRangeIterator(innerTwoPhase: TwoPhaseIterator, skipper: DocValuesSkipper, lowerValue: Long, upperValue: Long, queryRangeHasGaps: Boolean) : TwoPhaseIterator

Wrapper around a TwoPhaseIterator for a doc-values range query that speeds things up by taking advantage of a DocValuesSkipper.

Link copied to clipboard

Rewrites MultiTermQueries into a filter, using DocValues for term enumeration.

Link copied to clipboard
abstract class DoubleValues

Per-segment, per-document double values, which can be calculated at search-time

Link copied to clipboard

Base class for producing DoubleValues

Link copied to clipboard

Expert: Find exact phrases

Link copied to clipboard

Expert: Describes the score computation for document and query.

Link copied to clipboard
abstract class FieldComparator<T>

Expert: a FieldComparator compares hits so as to determine their sort order when collecting the top results with TopFieldCollector. The concrete public FieldComparator classes here correspond to the SortField types.

Link copied to clipboard
abstract class FieldComparatorSource

Provides a FieldComparator for custom field sorting.

Link copied to clipboard

Expert: A ScoreDoc which also contains information about how to sort the referenced document. In addition to the document number and score, this object contains an array of values for the document from the field(s) used to sort. For example, if the sort criteria was to sort by fields "a", "b" then "c", the fields object array will have three elements, corresponding respectively to the term values for the document in fields "a", "b" and "c". The class of each element in the array will be either Integer, Float or String depending on the type of values in the terms of each field.

Link copied to clipboard
class FieldExistsQuery(val field: String) : Query

A Query that matches documents that contain either a KnnFloatVectorField, [ ] or a field that indexes norms or doc values.

Link copied to clipboard

Expert: A hit queue for sorting by hits by terms in more than one field.

Link copied to clipboard
abstract class FilterCollector(in: Collector) : Collector

Collector delegator.

Link copied to clipboard

Abstract decorator class of a DocIdSetIterator implementation that provides on-demand filter/validation mechanism on an underlying DocIdSetIterator.

Link copied to clipboard
Link copied to clipboard
open class FilterScorable(in: Scorable) : Scorable

Filter a Scorable, intercepting methods and optionally changing their return values

Link copied to clipboard
abstract class FilterScorer(in: Scorer) : Scorer, Unwrappable<Scorer>

A FilterScorer contains another Scorer, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. The class FilterScorer itself simply implements all abstract methods of Scorer with versions that pass all requests to the contained scorer. Subclasses of FilterScorer may further override some of these methods and may also provide additional methods and fields.

Link copied to clipboard
abstract class FilterWeight : Weight

A FilterWeight contains another Weight and implements all abstract methods by delegating to the wrapped weight.

Link copied to clipboard
open class FloatVectorSimilarityQuery(field: String, target: FloatArray, traversalSimilarity: Float, resultSimilarity: Float, filter: Query? = null) : AbstractVectorSimilarityQuery

Search for all (approximate) float vectors above a similarity threshold.

Link copied to clipboard
class FuzzyQuery(term: Term, maxEdits: Int = defaultMaxEdits, prefixLength: Int = defaultPrefixLength, maxExpansions: Int = defaultMaxExpansions, transpositions: Boolean = defaultTranspositions, rewriteMethod: MultiTermQuery.RewriteMethod = defaultRewriteMethod(maxExpansions)) : MultiTermQuery

Implements the fuzzy search query. The similarity measurement is based on the Damerau-Levenshtein (optimal string alignment) algorithm, though you can explicitly choose classic Levenshtein by passing false to the transpositions parameter.

Link copied to clipboard

Subclass of TermsEnum for enumerating all terms that are similar to the specified filter term.

Link copied to clipboard
class HitQueue(size: Int, prePopulate: Boolean) : PriorityQueue<ScoreDoc?>

Expert: Priority queue containing hit docs

Link copied to clipboard

DocIdSetIterator that skips non-competitive docs thanks to the indexed impacts. Call .setMinCompetitiveScore in order to give this iterator the ability to skip low-scoring documents.

Link copied to clipboard
class IndexOrDocValuesQuery(val indexQuery: Query, val randomAccessQuery: Query) : Query

A query that uses either an index structure (points or terms) or doc values in order to run a query, depending which one is more efficient. This is typically useful for range queries, whose Weight.scorer is costly to create since it usually needs to sort large lists of doc ids. For instance, for a field that both indexed LongPoints and [ ]s with the same values, an efficient range query could be created by doing:

Link copied to clipboard
open class IndexSearcher(context: IndexReaderContext, executor: Executor? = null)

Implements search over a single IndexReader.

class IndexSortSortedNumericDocValuesRangeQuery(field: String, lowerValue: Long, upperValue: Long, val fallbackQuery: Query) : Query

A range query that can take advantage of the fact that the index is sorted to speed up execution. If the index is sorted on the same field as the query, it performs binary search on the field's numeric doc values to find the documents at the lower and upper ends of the range.

Link copied to clipboard

A Query that matches documents matching combinations of subqueries.

Link copied to clipboard
class IndriAndScorer(subScorers: MutableList<Scorer>, scoreMode: ScoreMode, boost: Float) : IndriDisjunctionScorer

Combines scores of subscorers. If a subscorer does not contain the docId, a smoothing score is calculated for that document/subscorer combination.

Link copied to clipboard
class IndriAndWeight(indriAndQuery: IndriAndQuery, searcher: IndexSearcher, scoreMode: ScoreMode, boost: Float) : Weight

The Weight for IndriAndQuery, used to normalize, score and explain these queries.

Link copied to clipboard

The Indri implemenation of a disjunction scorer which stores the subscorers for the child queries. The score and smoothingScore methods use the list of all subscorers and not just the matches so that a smoothingScore can be calculated if there is not an exact match.

Link copied to clipboard

A Basic abstract query that all IndriQueries can extend to implement toString, equals, getClauses, and iterator.

Link copied to clipboard
abstract class IndriScorer(boost: Float) : Scorer

The Indri parent scorer that stores the boost so that IndriScorers can use the boost outside of the term.

Link copied to clipboard
open class KnnByteVectorQuery @JvmOverloads constructor(field: String, target: ByteArray, k: Int, filter: Query? = null, searchStrategy: KnnSearchStrategy = DEFAULT) : AbstractKnnVectorQuery

Uses KnnVectorsReader.search to perform nearest neighbour search.

Link copied to clipboard
interface KnnCollector

KnnCollector is a knn collector used for gathering kNN results and providing topDocs from the gathered neighbors

Link copied to clipboard
open class KnnFloatVectorQuery(field: String, target: FloatArray, k: Int, filter: Query?, searchStrategy: KnnSearchStrategy) : AbstractKnnVectorQuery

Uses KnnVectorsReader.search to perform nearest neighbour search.

Link copied to clipboard
interface LeafCollector

Collector decouples the score from the collected doc: the score computation is skipped entirely if it's not needed. Collectors that do need the score should implement the {@link #setScorer} method, to hold onto the passed {@link Scorer} instance, and call {@link Scorer#score()} within the collect method to compute the current hit's score. If your collector may request the score for a single hit multiple times, you should use {@link ScoreCachingWrappingScorer}.

Link copied to clipboard

Expert: comparator that gets instantiated on each leaf from a top-level FieldComparator instance.

Link copied to clipboard

Tracks live field values across NRT reader reopens. This holds a map for all updated ids since the last reader reopen. Once the NRT reader is reopened, it prunes the map. This means you must reopen your NRT reader periodically otherwise the RAM consumption of this class will grow unbounded!

Link copied to clipboard
abstract class LongValues

Per-segment, per-document long values, which can be calculated at search-time

Link copied to clipboard

Base class for producing LongValues

Link copied to clipboard
open class LRUQueryCache(maxSize: Int, maxRamBytesUsed: Long, leavesToCache: (LeafReaderContext) -> Boolean = minSegmentSizePredicate(10000), skipCacheFactor: Float = 10.0f) : QueryCache, Accountable

A QueryCache that evicts queries using a LRU (least-recently-used) eviction policy in order to remain under a given maximum size and number of bytes used.

Link copied to clipboard

A query that matches all documents.

Link copied to clipboard
class MatchAllScorerSupplier(score: Float, scoreMode: ScoreMode, maxDoc: Int) : ScorerSupplier

ScorerSupplier that matches all docs.

Link copied to clipboard
interface Matches : Iterable<String>

Reports the positions and optionally offsets of all matching terms in a query for a single document

Link copied to clipboard
interface MatchesIterator

An iterator over match positions (and optionally offsets) for a single document and field

Link copied to clipboard

Contains static functions that aid the implementation of Matches and [ ] interfaces.

Link copied to clipboard
class MatchNoDocsQuery @JvmOverloads constructor(reason: String = "") : Query

A query that matches no documents.

Link copied to clipboard

Add this Attribute to a fresh AttributeSource before calling . FuzzyQuery is using this to control its internal behaviour to only return competitive terms.

Link copied to clipboard

Maintains the maximum score and its corresponding document id concurrently

Link copied to clipboard
class MaxScoreCache(impactsSource: ImpactsSource, scorer: Similarity.SimScorer)

Compute maximum scores based on Impacts and keep them in a cache in order not to run expensive similarity score computations multiple times on the same data.

Link copied to clipboard

A Collector which allows running a search with several Collectors. It offers a static wrap method which accepts a list of collectors and wraps them with MultiCollector, while filtering out the null ones.

Link copied to clipboard

A composite CollectorManager which wraps a set of CollectorManager instances, akin to how MultiCollector wraps Collector instances.

Link copied to clipboard

Scorer that sums document's norms from multiple fields.

Link copied to clipboard

A generalized version of PhraseQuery, with the possibility of adding more than one term at the same position that are treated as a disjunction (OR). To use this class to search for the phrase "Microsoft app*" first create a Builder and use Builder.add on the term "microsoft" (assuming lowercase analysis), then find all terms that have "app" as prefix using LeafReader.terms, seeking to "app" then iterating and collecting terms until there is no longer that prefix, and finally use Builder.add to add them. returns the fully constructed (and immutable) MultiPhraseQuery.

Link copied to clipboard

A Multiset is a set that allows for duplicate elements. Two Multisets are equal if they contain the same unique elements and if each unique element has as many occurrences in both multisets. Iteration order is not specified.

Link copied to clipboard
abstract class MultiTermQuery(field: String, rewriteMethod: MultiTermQuery.RewriteMethod) : Query

An abstract Query that matches documents containing a subset of terms provided by a FilteredTermsEnum enumeration.

Link copied to clipboard
class NamedMatches(val name: String, in: Matches) : Matches

Utility class to help extract the set of sub queries that have matched from a larger query.

Link copied to clipboard
class NGramPhraseQuery(val n: Int, phraseQuery: PhraseQuery) : Query

This is a PhraseQuery which is optimized for n-gram phrase query. For example, when you query "ABCD" on a 2-gram field, you may want to use NGramPhraseQuery rather than PhraseQuery, because NGramPhraseQuery will Query.rewrite the query to "AB/0 CD/2", while PhraseQuery will query "AB/0 BC/1 CD/2" (where term/position).

Link copied to clipboard
abstract class PhraseMatcher

Base class for exact and sloppy phrase matching

Link copied to clipboard
class PhrasePositions(val postings: PostingsEnum, o: Int, val ord: Int, val terms: Array<out Term>?)

Position of a term in a document that takes into account the term offset within the phrase.

Link copied to clipboard

A Query that matches documents containing a particular sequence of terms. A PhraseQuery is built by QueryParser for input like "new york".

Link copied to clipboard
Link copied to clipboard
abstract class PhraseWeight : Weight

Expert: Weight class for phrase matching

Link copied to clipboard

Abstract query class to find all documents whose single or multi-dimensional point values, previously indexed with e.g. IntPoint, is contained in the specified set.

Link copied to clipboard
abstract class PointRangeQuery : Query

Abstract class for range queries against single or multidimensional points such as [ ].

Link copied to clipboard

A Collector implementation which wraps another Collector and makes sure only documents with scores > 0 are collected.

Link copied to clipboard
class PrefixQuery(prefix: Term, rewriteMethod: MultiTermQuery.RewriteMethod = CONSTANT_SCORE_BLENDED_REWRITE) : AutomatonQuery

A Query that matches documents containing terms with a specified prefix. A PrefixQuery is built by QueryParser for input like app*.

Link copied to clipboard

Controls LeafFieldComparator how to skip documents

Link copied to clipboard
abstract class Query
Link copied to clipboard
interface QueryCache

A cache for queries.

Link copied to clipboard

A policy defining which filters should be cached.

Link copied to clipboard
abstract class QueryRescorer(query: Query) : Rescorer

A Rescorer that uses a provided Query to assign scores to the first-pass hits.

Link copied to clipboard
abstract class QueryVisitor

Allows recursion through a query tree

Link copied to clipboard
abstract class ReferenceManager<G> : AutoCloseable

Utility class to safely share instances of a certain type across multiple threads, while periodically refreshing them. This class ensures each reference is closed only once all threads have finished using it. It is recommended to consult the documentation of ReferenceManager implementations for their maybeRefresh semantics.

Link copied to clipboard
class RegexpQuery(term: Term, syntaxFlags: Int, matchFlags: Int, provider: AutomatonProvider, determinizeWorkLimit: Int, rewriteMethod: MultiTermQuery.RewriteMethod, doDeterminization: Boolean = true) : AutomatonQuery

A fast regular expression query based on the org.gnit.lucenekmp.util.automaton package.

Link copied to clipboard
abstract class Rescorer

Re-scores the topN results (TopDocs) from an original query. See QueryRescorer for an actual implementation. Typically, you run a low-cost first-pass query across the entire index, collecting the top few hundred hits perhaps, and then use this class to mix in a more costly second pass scoring.

Link copied to clipboard
abstract class Scorable

Allows access to the score of a Query

Link copied to clipboard

A Scorer which wraps another scorer and caches the score of the current document. Successive calls to .score will return the same result and will not invoke the wrapped Scorer's score() method, unless the current document has changed.

This class might be useful due to the changes done to the Collector interface, in which the score is not computed for a document by default, only if the collector requests it. Some collectors may need to use the score in several places, however all they have in hand is a [ ] object, and might end up computing the score of a document more than once.

Link copied to clipboard
open class ScoreDoc @JvmOverloads constructor(var doc: Int, var score: Float, var shardIndex: Int = -1)

Holds one hit in TopDocs.

Link copied to clipboard
Link copied to clipboard
abstract class Scorer : Scorable

Expert: Common scoring functionality for different types of queries.

Link copied to clipboard
abstract class ScorerSupplier

A supplier of Scorer. This allows to get an estimate of the cost before building the Scorer.

Link copied to clipboard

Base rewrite method that translates each term into a query, and keeps the scores as computed by the query.

Link copied to clipboard
open class SearcherFactory

Factory class used by SearcherManager to create new IndexSearchers. The default implementation just creates an IndexSearcher with no custom behavior:

Link copied to clipboard

Keeps track of current plus old IndexSearchers, closing the old ones once they have timed out.

Link copied to clipboard

Utility class to safely share IndexSearcher instances across multiple threads, while periodically reopening. This class ensures each searcher is closed only once all threads have finished using it.

Link copied to clipboard

This is a version of knn vector query that provides a query seed to initiate the vector search. NOTE: The underlying format is free to ignore the provided seed

Link copied to clipboard

Interface defining whether or not an object can be cached against a LeafReader

Link copied to clipboard

Base Collector implementation that is used to collect all contexts.

Link copied to clipboard

Base FieldComparator implementation that is used for all contexts.

Link copied to clipboard
class SloppyPhraseMatcher(postings: Array<PhraseQuery.PostingsAndFreq>, slop: Int, scoreMode: ScoreMode, scorer: Similarity.SimScorer, matchCost: Float, captureLeadMatch: Boolean) : PhraseMatcher

Find all slop-valid position-combinations (matches) encountered while traversing/hopping the PhrasePositions.

The sloppy frequency contribution of a match depends on the distance:

Link copied to clipboard
class Sort(fields: SortField)

Encapsulates sort criteria for returned hits.

Link copied to clipboard

Selects a value from the document's list to use as the representative value

Link copied to clipboard
class SortedNumericSortField(field: String, var type: SortField.Type, reverse: Boolean = false, selector: SortedNumericSelector.Type = SortedNumericSelector.Type.MIN) : SortField

SortField for SortedNumericDocValues.

Link copied to clipboard

Selects a value from the document's set to use as the representative value

Link copied to clipboard
class SortedSetSortField(field: String, reverse: Boolean, val selector: SortedSetSelector.Type = SortedSetSelector.Type.MIN) : SortField

SortField for SortedSetDocValues.

Link copied to clipboard
open class SortField

Stores information about how to sort documents by terms in an individual field. Fields must be indexed in order to sort by them.

Link copied to clipboard
class SortRescorer(sort: Sort) : Rescorer

A Rescorer that re-sorts according to a provided Sort.

Link copied to clipboard

A query that treats multiple terms as synonyms.

Link copied to clipboard
class TaskExecutor(executor: Executor)

Executor wrapper responsible for the execution of concurrent tasks. Used to parallelize search across segments as well as query rewrite in some cases. Exposes a single .invokeAll method that takes a collection of Callables and executes them concurrently. Once all but one task have been submitted to the executor, it tries to run as many tasks as possible on the calling thread, then waits for all tasks that have been executed in parallel on the executor to be completed and then returns a list with the obtained results.

Link copied to clipboard
Link copied to clipboard

Specialization for a disjunction over many terms that, by default, behaves like a [ ] over a BooleanQuery containing only clauses.

Link copied to clipboard
open class TermQuery : Query

A Query that matches documents containing a term. This may be combined with other terms with a BooleanQuery.

Link copied to clipboard
class TermRangeQuery(field: String, lowerTerm: BytesRef?, upperTerm: BytesRef?, includeLower: Boolean, includeUpper: Boolean, rewriteMethod: MultiTermQuery.RewriteMethod = CONSTANT_SCORE_BLENDED_REWRITE) : AutomatonQuery

A Query that matches documents within an range of terms.

Link copied to clipboard

Expert: A Scorer for documents matching a Term.

Link copied to clipboard
class TermStatistics(term: BytesRef, val docFreq: Long, val totalTermFreq: Long)

Contains statistics for a specific term

Link copied to clipboard

A KnnCollectorManager that collects results with a timeout.

Link copied to clipboard
open class TopDocs(var totalHits: TotalHits, var scoreDocs: Array<ScoreDoc>)

Represents hits returned by IndexSearcher.search.

Link copied to clipboard
abstract class TopDocsCollector<T : ScoreDoc> : Collector

A base class for all collectors that return a TopDocs output. This collector allows easy extension by providing a single constructor which accepts a PriorityQueue as well as protected members for that priority queue and a counter of the number of total hits.

Extending classes can override any of the methods to provide their own implementation, as well as avoid the use of the priority queue entirely by passing null to .TopDocsCollector. In that case however, you might want to consider overriding all methods, in order to avoid a NullPointerException.

Link copied to clipboard
Link copied to clipboard
class TopFieldCollectorManager(sort: Sort, numHits: Int, after: FieldDoc?, totalHitsThreshold: Int) : CollectorManager<TopFieldCollector, TopFieldDocs>

Create a TopFieldCollectorManager which uses a shared hit counter to maintain number of hits and a shared MaxScoreAccumulator to propagate the minimum score across segments if the primary sort is by relevancy.

Link copied to clipboard
class TopFieldDocs(totalHits: TotalHits?, scoreDocs: Array<ScoreDoc>, var fields: Array<SortField>?) : TopDocs

Represents hits returned by IndexSearcher.search.

Link copied to clipboard
open class TopKnnCollector @JvmOverloads constructor(k: Int, visitLimit: Int, searchStrategy: KnnSearchStrategy? = null) : AbstractKnnCollector

TopKnnCollector is a specific KnnCollector. A minHeap is used to keep track of the currently collected vectors allowing for efficient updates as better vectors are collected.

Link copied to clipboard

A Collector implementation that collects the top-scoring hits, returning them as a [ ]. This is used by IndexSearcher to implement TopDocs-based search. Hits are sorted by score descending and then (when the scores are tied) docID ascending. When you create an instance of this collector you should know in advance whether documents are going to be collected in doc Id order or not.

Link copied to clipboard
class TopScoreDocCollectorManager(numHits: Int, after: ScoreDoc?, totalHitsThreshold: Int) : CollectorManager<TopScoreDocCollector, TopDocs>

Create a TopScoreDocCollectorManager which uses a shared hit counter to maintain number of hits and a shared MaxScoreAccumulator to propagate the minimum score across segments

Link copied to clipboard
abstract class TopTermsRewrite<B>(val size: Int) : TermCollectingRewrite<B>

Base rewrite method for collecting only the top terms via a priority queue.

Link copied to clipboard

Just counts the total number of hits. This is the collector behind IndexSearcher.count. When the Weight implements Weight.count, this collector will skip collecting segments.

Link copied to clipboard

Collector manager based on TotalHitCountCollector that allows users to parallelize counting the number of hits, expected to be used mostly wrapped in MultiCollectorManager. For cases when this is the only collector manager used, IndexSearcher.count should be called instead of IndexSearcher.search as the former is faster whenever the count can be returned directly from the index statistics.

Link copied to clipboard
data class TotalHits(val value: Long, val relation: TotalHits.Relation)

Description of the total number of hits of a query. The total hit count can't generally be computed accurately without visiting all matches, which is costly for queries that match lots of documents. Given that it is often enough to have a lower bounds of the number of hits, such as "there are more than 1000 hits", Lucene has options to stop counting as soon as a threshold has been reached in order to improve query times.

Link copied to clipboard
abstract class TwoPhaseIterator

Returned by Scorer.twoPhaseIterator to expose an approximation of a [ ]. When the .approximation's DocIdSetIterator.nextDoc or DocIdSetIterator.advance return, .matches needs to be checked in order to know whether the returned doc ID actually matches.

Link copied to clipboard
open class UsageTrackingQueryCachingPolicy(historySize: Int = 256) : QueryCachingPolicy

A QueryCachingPolicy that tracks usage statistics of recently-used filters in order to decide on which filters are worth caching.

Link copied to clipboard
interface VectorScorer

Computes the similarity score between a given query vector and different document vectors. This is used for exact searching and scoring

Link copied to clipboard
class VectorSimilarityCollector(traversalSimilarity: Float, resultSimilarity: Float, visitLimit: Long) : AbstractKnnCollector

Perform a similarity-based graph search.

Link copied to clipboard
abstract class Weight : SegmentCacheable

Expert: Calculate query weights and build query scorers.

Link copied to clipboard
class WildcardQuery(term: Term, determinizeWorkLimit: Int = Operations.DEFAULT_DETERMINIZE_WORK_LIMIT, rewriteMethod: MultiTermQuery.RewriteMethod = CONSTANT_SCORE_BLENDED_REWRITE) : AutomatonQuery

Implements the wildcard search query. Supported wildcards are *, which matches any character sequence (including the empty one), and ``, which matches any single character. '\' is the escape character.

Functions

Link copied to clipboard