org.apache.lucene.sandbox.queries.regex

## Class RegexQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.search.MultiTermQuery
    - - org.apache.lucene.sandbox.queries.regex.RegexQuery

All Implemented Interfaces:
  Cloneable, RegexQueryCapable

    public class RegexQuery
    extends MultiTermQuery
    implements RegexQueryCapable

Implements the regular expression term search query. The expressions supported depend on the regular expression implementation used by way of the `RegexCapabilities` interface.

NOTE: You may wish to consider using the regex query support in `RegexpQuery` instead, as it has better performance.

See Also:
  `RegexTermsEnum`

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.lucene.search.MultiTermQuery

`MultiTermQuery.ConstantScoreAutoRewrite, MultiTermQuery.RewriteMethod, MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite, MultiTermQuery.TopTermsScoringBooleanQueryRewrite`

### Field Summary

### Fields inherited from class org.apache.lucene.search.MultiTermQuery

`CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, CONSTANT_SCORE_FILTER_REWRITE, field, rewriteMethod, SCORING_BOOLEAN_QUERY_REWRITE`

### Constructor Summary

Constructors
Constructor and Description
`RegexQuery(Term term)` Constructs a query for terms matching `term`.

### Method Summary

Methods
`boolean` `equals(Object obj)`
`RegexCapabilities` `getRegexImplementation()` Returns the implementation used by this instance.
`Term` `getTerm()`
`protected FilteredTermsEnum` `getTermsEnum(Terms terms, AttributeSource atts)`
`int` `hashCode()`
`void` `setRegexImplementation(RegexCapabilities impl)` Defines which `RegexCapabilities` implementation is used by this instance.
`String` `toString(String field)`

### Methods inherited from class org.apache.lucene.search.MultiTermQuery

`getField, getRewriteMethod, getTermsEnum, rewrite, setRewriteMethod`

### Methods inherited from class org.apache.lucene.search.Query

`clone, createWeight, extractTerms, getBoost, setBoost, toString`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### RegexQuery

    public RegexQuery(Term term)

Constructs a query for terms matching `term`.

### Method Detail

#### getTerm

    public Term getTerm()

#### setRegexImplementation

    public void setRegexImplementation(RegexCapabilities impl)

Description copied from interface: `RegexQueryCapable`
Defines which `RegexCapabilities` implementation is used by this instance.

Specified by:
  `setRegexImplementation` in interface `RegexQueryCapable`
See Also:
  `RegexQueryCapable.getRegexImplementation()`

#### getRegexImplementation

    public RegexCapabilities getRegexImplementation()

Description copied from interface: `RegexQueryCapable`
Returns the implementation used by this instance.

Specified by:
  `getRegexImplementation` in interface `RegexQueryCapable`
See Also:
  `RegexQueryCapable.setRegexImplementation(RegexCapabilities)`

#### getTermsEnum

    protected FilteredTermsEnum getTermsEnum(Terms terms,
                                 AttributeSource atts)
                                      throws IOException

Specified by:
  `getTermsEnum` in class `MultiTermQuery`
Throws:
  `IOException`

#### toString

    public String toString(String field)

Specified by:
  `toString` in class `Query`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `MultiTermQuery`

#### equals

    public boolean equals(Object obj)

Overrides:
  `equals` in class `MultiTermQuery`