org.apache.lucene.queries

## Class TermsQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.queries.TermsQuery

- All Implemented Interfaces:
    Accountable

  Deprecated.
  Use `TermInSetQuery`

      @Deprecated
      public class TermsQuery
      extends Query
      implements Accountable

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TermsQuery(Collection<Term> terms)` Deprecated. Creates a new `TermsQuery` from the given collection.
    `TermsQuery(String field, BytesRef... terms)` Deprecated. Creates a new `TermsQuery` from the given `BytesRef` array for a single field.
    `TermsQuery(String field, Collection<BytesRef> terms)` Deprecated. Creates a new `TermsQuery` from the given collection for a single field.
    `TermsQuery(Term... terms)` Deprecated. Creates a new `TermsQuery` from the given array.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)` Deprecated.
    `int` | `hashCode()` Deprecated.
    `long` | `ramBytesUsed()` Deprecated.
    `Query` | `rewrite(IndexReader reader)` Deprecated.
    `String` | `toString(String field)` Deprecated.

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

      `classHash, createWeight, sameClassAs, toString`

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

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

    - ### Methods inherited from interface org.apache.lucene.util.Accountable

      `getChildResources`

- - ### Constructor Detail

    - #### TermsQuery

          public TermsQuery(Collection<Term> terms)

      Deprecated.
      Creates a new `TermsQuery` from the given collection. It can contain duplicate terms and multiple fields.

    - #### TermsQuery

          public TermsQuery(String field,
                            Collection<BytesRef> terms)

      Deprecated.
      Creates a new `TermsQuery` from the given collection for a single field. It can contain duplicate terms.

    - #### TermsQuery

          public TermsQuery(String field,
                            BytesRef... terms)

      Deprecated.
      Creates a new `TermsQuery` from the given `BytesRef` array for a single field.

    - #### TermsQuery

          public TermsQuery(Term... terms)

      Deprecated.
      Creates a new `TermsQuery` from the given array. The array can contain duplicate terms and multiple fields.

  - ### Method Detail

    - #### rewrite

          public Query rewrite(IndexReader reader)
                        throws IOException

      Deprecated.
      Overrides:
        `rewrite` in class `Query`
      Throws:
        `IOException`

    - #### equals

          public boolean equals(Object obj)

      Deprecated.
      Specified by:
        `equals` in class `Query`

    - #### hashCode

          public int hashCode()

      Deprecated.
      Specified by:
        `hashCode` in class `Query`

    - #### toString

          public String toString(String field)

      Deprecated.
      Specified by:
        `toString` in class `Query`

    - #### ramBytesUsed

          public long ramBytesUsed()

      Deprecated.
      Specified by:
        `ramBytesUsed` in interface `Accountable`

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