org.apache.lucene.search

## Class WildcardQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.search.MultiTermQuery
    - - org.apache.lucene.search.WildcardQuery

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

      public class WildcardQuery
      extends MultiTermQuery

  Implements the wildcard search query. Supported wildcards are `*`, which matches any character sequence (including the empty one), and `?`, which matches any single character. Note this query can be slow, as it needs to iterate over many terms. In order to prevent extremely slow WildcardQueries, a Wildcard term should not start with one of the wildcards `*` or `?`.

  This query uses the `MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT` rewrite method.

  See Also:
    `WildcardTermEnum`, Serialized Form

- - ### Nested Class Summary

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

      `MultiTermQuery.ConstantScoreAutoRewrite, MultiTermQuery.RewriteMethod`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Term` | `term`

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

      `CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, CONSTANT_SCORE_FILTER_REWRITE, rewriteMethod, SCORING_BOOLEAN_QUERY_REWRITE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WildcardQuery(Term term)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)`
    `protected FilteredTermEnum` | `getEnum(IndexReader reader)` Construct the enumeration to be used, expanding the pattern term.
    `Term` | `getTerm()` Returns the pattern term.
    `int` | `hashCode()`
    `Query` | `rewrite(IndexReader reader)` Expert: called to re-write queries into primitive queries.
    `java.lang.String` | `toString(java.lang.String field)` Prints a user-readable version of this query.

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

      `clearTotalNumberOfTerms, getRewriteMethod, getTotalNumberOfTerms, incTotalNumberOfTerms, setRewriteMethod`

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

      `clone, combine, createWeight, extractTerms, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight`

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

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

- - ### Field Detail

    - #### term

          protected Term term

  - ### Constructor Detail

    - #### WildcardQuery

          public WildcardQuery(Term term)

  - ### Method Detail

    - #### getEnum

          protected FilteredTermEnum getEnum(IndexReader reader)
                                      throws java.io.IOException

      Description copied from class: `MultiTermQuery`
      Construct the enumeration to be used, expanding the pattern term.
      Specified by:
        `getEnum` in class `MultiTermQuery`
      Throws:
        `java.io.IOException`

    - #### getTerm

          public Term getTerm()

      Returns the pattern term.
      Overrides:
        `getTerm` in class `MultiTermQuery`

    - #### rewrite

          public Query rewrite(IndexReader reader)
                        throws java.io.IOException

      Description copied from class: `Query`
      Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
      Overrides:
        `rewrite` in class `MultiTermQuery`
      Throws:
        `java.io.IOException`

    - #### toString

          public java.lang.String toString(java.lang.String field)

      Prints a user-readable version of this query.
      Overrides:
        `toString` in class `MultiTermQuery`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `MultiTermQuery`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `MultiTermQuery`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.