org.apache.lucene.search

## Class CoveringQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.search.CoveringQuery

- All Implemented Interfaces:
    Accountable

      public final class CoveringQuery
      extends Query
      implements Accountable

  A `Query` that allows to have a configurable number or required matches per document. This is typically useful in order to build queries whose query terms must all appear in documents.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

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

      `NULL_ACCOUNTABLE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CoveringQuery(Collection<Query> queries, LongValuesSource minimumNumberMatch)` Sole constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Weight` | `createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)`
    `boolean` | `equals(Object obj)`
    `int` | `hashCode()`
    `long` | `ramBytesUsed()`
    `Query` | `rewrite(IndexReader reader)`
    `String` | `toString(String field)`
    `void` | `visit(QueryVisitor visitor)`

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

      `classHash, 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

    - #### CoveringQuery

          public CoveringQuery(Collection<Query> queries,
                               LongValuesSource minimumNumberMatch)

      Sole constructor.
      Parameters:
        `queries` - Sub queries to match.
        `minimumNumberMatch` - Per-document long value that records how many queries should match. Values that are less than 1 are treated like `1`: only documents that have at least one matching clause will be considered matches. Documents that do not have a value for `minimumNumberMatch` do not match.

  - ### Method Detail

    - #### toString

          public String toString(String field)

      Specified by:
        `toString` in class `Query`

    - #### equals

          public boolean equals(Object obj)

      Specified by:
        `equals` in class `Query`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in class `Query`

    - #### ramBytesUsed

          public long ramBytesUsed()

      Specified by:
        `ramBytesUsed` in interface `Accountable`

    - #### rewrite

          public Query rewrite(IndexReader reader)
                        throws IOException

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

    - #### visit

          public void visit(QueryVisitor visitor)

      Overrides:
        `visit` in class `Query`

    - #### createWeight

          public Weight createWeight(IndexSearcher searcher,
                                     ScoreMode scoreMode,
                                     float boost)
                              throws IOException

      Overrides:
        `createWeight` in class `Query`
      Throws:
        `IOException`

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