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 .*
Note
This API is experimental and might change in incompatible ways in the next release.
Inherited Members
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public class RegexpQuery : AutomatonQuery
Constructors
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. |
See Also
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 |
See Also
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 |
See Also
Methods
ToString(string)
Prints a user-readable version of this query.
Declaration
public override string ToString(string field)
Parameters
Type | Name | Description |
---|---|---|
string | field |
Returns
Type | Description |
---|---|
string |