AutomatonQuery

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.

This query will match documents that contain terms accepted by a given finite-state machine. The automaton can be constructed with the org.gnit.lucenekmp.util.automaton API. Alternatively, it can be created from a regular expression with RegexpQuery or from the standard Lucene wildcard syntax with WildcardQuery.

When the query is executed, it will will enumerate the term dictionary in an intelligent way to reduce the number of comparisons. For example: the regular expression of [dl]og will make approximately four comparisons: do, dog, lo, and log.

Inheritors

Constructors

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

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).

Link copied to clipboard
open val field: String

Returns the field name for this query

Link copied to clipboard

Is this a binary (byte) oriented automaton. See the constructor.

Link copied to clipboard
open val termsCount: Long

Functions

Link copied to clipboard
open fun createWeight(searcher: IndexSearcher, scoreMode: ScoreMode, boost: Float): Weight

Expert: Constructs an appropriate Weight implementation for this query.

Link copied to clipboard
open operator override fun equals(obj: Any?): Boolean

Override and implement query instance equivalence properly in a subclass. This is required so that QueryCache works properly.

Link copied to clipboard

Constructs an enumeration that expands the pattern term. This method should only be called if the field exists (ie, implementations can assume the field does exist). This method never returns null. The returned TermsEnum is positioned to the first matching term.

Link copied to clipboard
open override fun hashCode(): Int

Override and implement query hash code properly in a subclass. This is required so that [ ] works properly.

Link copied to clipboard
open override fun ramBytesUsed(): Long

Returns the automaton used to create this query

Link copied to clipboard
open override fun rewrite(indexSearcher: IndexSearcher): Query

To rewrite to a simpler form, instead return a simpler enum from .getTermsEnum. For example, to rewrite to a single term, return a SingleTermsEnum

Link copied to clipboard
open override fun toString(field: String?): String

Prints a query to a string, with field assumed to be the default field and omitted.

open override fun toString(): String

Prints a query to a string.

Link copied to clipboard
open override fun visit(visitor: QueryVisitor)

Recurse through the query tree, visiting any child queries.