org.apache.lucene.monitor

## Class CandidateMatcher<T extends QueryMatch>

- java.lang.Object
- - org.apache.lucene.monitor.CandidateMatcher<T>

- Direct Known Subclasses:
    ParallelMatcher, PartitionMatcher

      public abstract class CandidateMatcher<T extends QueryMatch>
      extends Object

  Class used to match candidate queries selected by a Presearcher from a Monitor query index.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected IndexSearcher` | `searcher` The searcher to run candidate queries against

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CandidateMatcher(IndexSearcher searcher)` Creates a new CandidateMatcher for the supplied DocumentBatch

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addMatch(T match, int doc)` Record a match
    `protected void` | `copyMatches(CandidateMatcher<T> other)` Copy all matches from another CandidateMatcher
    `protected void` | `doFinish()` Called when all monitoring of a batch of documents is complete
    `protected abstract void` | `matchQuery(String queryId, Query matchQuery, Map<String,String> metadata)` Runs the supplied query against this CandidateMatcher's set of documents, storing any resulting match, and recording the query in the presearcher hits
    `abstract T` | `resolve(T match1, T match2)` If two matches from the same query are found (for example, two branches of a disjunction), combine them.

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

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

- - ### Field Detail

    - #### searcher

          protected final IndexSearcher searcher

      The searcher to run candidate queries against

  - ### Constructor Detail

    - #### CandidateMatcher

          public CandidateMatcher(IndexSearcher searcher)

      Creates a new CandidateMatcher for the supplied DocumentBatch
      Parameters:
        `searcher` - the IndexSearcher to run queries against

  - ### Method Detail

    - #### matchQuery

          protected abstract void matchQuery(String queryId,
                                             Query matchQuery,
                                             Map<String,String> metadata)
                                      throws IOException

      Runs the supplied query against this CandidateMatcher's set of documents, storing any resulting match, and recording the query in the presearcher hits
      Parameters:
        `queryId` - the query id
        `matchQuery` - the query to run
        `metadata` - the query metadata
      Throws:
        `IOException` - on IO errors

    - #### addMatch

          protected final void addMatch(T match,
                                        int doc)

      Record a match
      Parameters:
        `match` - a QueryMatch object

    - #### resolve

          public abstract T resolve(T match1,
                                    T match2)

      If two matches from the same query are found (for example, two branches of a disjunction), combine them.
      Parameters:
        `match1` - the first match found
        `match2` - the second match found
      Returns:
        a Match object that combines the two

    - #### doFinish

          protected void doFinish()

      Called when all monitoring of a batch of documents is complete

    - #### copyMatches

          protected void copyMatches(CandidateMatcher<T> other)

      Copy all matches from another CandidateMatcher

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