Package org.apache.lucene.monitor

## Class Presearcher

- java.lang.Object
- - org.apache.lucene.monitor.Presearcher

- Direct Known Subclasses:
    `TermFilteredPresearcher`

      public abstract class Presearcher
      extends Object

  A Presearcher is used by the Monitor to reduce the number of queries actually run against a Document. It defines how queries are stored in the monitor's internal index, and how a Document is converted to a query against that index.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static Presearcher` | `NO_FILTERING` | A Presearcher implementation that does no query filtering, and runs all registered queries

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Presearcher()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract Query` | `buildQuery​(LeafReader reader, BiPredicate<String,​BytesRef> termAcceptor)` | Build a query for a Monitor's queryindex from a LeafReader over a set of documents to monitor.
    `abstract Document` | `indexQuery​(Query query, Map<String,​String> metadata)` | Build a lucene Document to index the query in a Monitor's queryindex

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NO_FILTERING

          public static final Presearcher NO_FILTERING

      A Presearcher implementation that does no query filtering, and runs all registered queries

  - ### Constructor Detail

    - #### Presearcher

          public Presearcher()

  - ### Method Detail

    - #### buildQuery

          public abstract Query buildQuery​(LeafReader reader,
                                           BiPredicate<String,​BytesRef> termAcceptor)

      Build a query for a Monitor's queryindex from a LeafReader over a set of documents to monitor.
      Parameters:
        `reader` - a `LeafReader` over the input documents
        `termAcceptor` - a predicate indicating if a term should be added to the query
      Returns:
        a Query to run over a Monitor's queryindex

    - #### indexQuery

          public abstract Document indexQuery​(Query query,
                                              Map<String,​String> metadata)

      Build a lucene Document to index the query in a Monitor's queryindex
      Parameters:
        `query` - the Query to index
        `metadata` - a Map of arbitrary query metadata
      Returns:
        a lucene Document to add to the queryindex