Show / Hide Table of Contents

    Class RegexpQuery

    A fast regular expression query based on the Lucene.Net.Util.Automaton package.

    • Comparisons are fast
    • The term dictionary is enumerated in an intelligent way, to avoid comparisons. See AutomatonQuery for more details.

    The supported syntax is documented in the RegExp class. Note this might be different than other regular expression implementations. For some alternatives with different syntax, look under the sandbox.

    Note this query can be slow, as it needs to iterate over many terms. In order to prevent extremely slow RegexpQuerys, a RegExp term should not start with the expression .*

    This is a Lucene.NET EXPERIMENTAL API, use at your own risk
    Inheritance
    System.Object
    Query
    MultiTermQuery
    AutomatonQuery
    RegexpQuery
    Inherited Members
    AutomatonQuery.m_automaton
    AutomatonQuery.m_compiled
    AutomatonQuery.m_term
    AutomatonQuery.GetTermsEnum(Terms, AttributeSource)
    AutomatonQuery.GetHashCode()
    AutomatonQuery.Equals(Object)
    AutomatonQuery.Automaton
    MultiTermQuery.m_field
    MultiTermQuery.m_rewriteMethod
    MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE
    MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE
    MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE
    MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT
    MultiTermQuery.Field
    MultiTermQuery.GetTermsEnum(Terms)
    MultiTermQuery.Rewrite(IndexReader)
    MultiTermQuery.MultiTermRewriteMethod
    Query.Boost
    Query.ToString()
    Query.CreateWeight(IndexSearcher)
    Query.ExtractTerms(ISet<Term>)
    Query.Clone()
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.dll
    Syntax
    public class RegexpQuery : AutomatonQuery

    Constructors

    | Improve this Doc View Source

    RegexpQuery(Term)

    Constructs a query for terms matching term.

    By default, all regular expression features are enabled.

    Declaration
    public RegexpQuery(Term term)
    Parameters
    Type Name Description
    Term term

    Regular expression.

    | Improve this Doc View Source

    RegexpQuery(Term, RegExpSyntax)

    Constructs a query for terms matching term.

    Declaration
    public RegexpQuery(Term term, RegExpSyntax flags)
    Parameters
    Type Name Description
    Term term

    Regular expression.

    RegExpSyntax flags

    Optional RegExp features from RegExpSyntax

    | Improve this Doc View Source

    RegexpQuery(Term, RegExpSyntax, IAutomatonProvider)

    Constructs a query for terms matching term.

    Declaration
    public RegexpQuery(Term term, RegExpSyntax flags, IAutomatonProvider provider)
    Parameters
    Type Name Description
    Term term

    Regular expression.

    RegExpSyntax flags

    Optional RegExp features from RegExpSyntax

    IAutomatonProvider provider

    Custom IAutomatonProvider for named automata

    Methods

    | Improve this Doc View Source

    ToString(String)

    Prints a user-readable version of this query.

    Declaration
    public override string ToString(string field)
    Parameters
    Type Name Description
    System.String field
    Returns
    Type Description
    System.String
    Overrides
    AutomatonQuery.ToString(String)

    See Also

    RegExp
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)