org.apache.lucene.monitor

## Class MultipassTermFilteredPresearcher

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

-     public class MultipassTermFilteredPresearcher
      extends TermFilteredPresearcher

  A TermFilteredPresearcher that indexes queries multiple times, with terms collected from different routes through a querytree. Each route will produce a set of terms that are *sufficient* to select the query, and are indexed into a separate, suffixed field.

  Incoming documents are then converted to a set of Disjunction queries over each suffixed field, and these queries are combined into a conjunction query, such that the document's set of terms must match a term from each route.

  This allows filtering out of documents that contain one half of a two-term phrase query, for example. The query `"hello world"` will be indexed twice, once under 'hello' and once under 'world'. A document containing the terms "hello there" would match the first field, but not the second, and so would not be selected for matching.

  The number of passes the presearcher makes is configurable. More passes will improve the selected/matched ratio, but will take longer to index and will use more RAM.

  A minimum weight can we set for terms to be chosen for the second and subsequent passes. This allows users to avoid indexing stopwords, for example.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.lucene.monitor.TermFilteredPresearcher

      `TermFilteredPresearcher.BytesRefHashIterator, TermFilteredPresearcher.DocumentQueryBuilder`

  - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.monitor.TermFilteredPresearcher

      `DEFAULT_WEIGHTOR`

    - ### Fields inherited from class org.apache.lucene.monitor.Presearcher

      `NO_FILTERING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultipassTermFilteredPresearcher(int passes)` Construct a new MultipassTermFilteredPresearcher using `TermFilteredPresearcher.DEFAULT_WEIGHTOR`
    `MultipassTermFilteredPresearcher(int passes, float minWeight, TermWeightor weightor, List<CustomQueryHandler> queryHandlers, Set<String> filterFields)` Construct a new MultipassTermFilteredPresearcher

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Document` | `buildQueryDocument(QueryTree querytree)` Builds a `Document` from the terms extracted from a query
    `protected TermFilteredPresearcher.DocumentQueryBuilder` | `getQueryBuilder()` Returns a `TermFilteredPresearcher.DocumentQueryBuilder` for this presearcher

    - ### Methods inherited from class org.apache.lucene.monitor.TermFilteredPresearcher

      `buildQuery, collectTerms, indexQuery`

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

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

- - ### Constructor Detail

    - #### MultipassTermFilteredPresearcher

          public MultipassTermFilteredPresearcher(int passes,
                                                  float minWeight,
                                                  TermWeightor weightor,
                                                  List<CustomQueryHandler> queryHandlers,
                                                  Set<String> filterFields)

      Construct a new MultipassTermFilteredPresearcher
      Parameters:
        `passes` - the number of times a query should be indexed
        `minWeight` - the minimum weight a querytree should be advanced over
        `weightor` - the TreeWeightor to use
        `queryHandlers` - a list of custom query handlers
        `filterFields` - a set of fields to use as filters

    - #### MultipassTermFilteredPresearcher

          public MultipassTermFilteredPresearcher(int passes)

      Construct a new MultipassTermFilteredPresearcher using `TermFilteredPresearcher.DEFAULT_WEIGHTOR`

      Note that this will be constructed with a minimum advance weight of zero

      Parameters:
        `passes` - the number of times a query should be indexed

  - ### Method Detail

    - #### getQueryBuilder

          protected TermFilteredPresearcher.DocumentQueryBuilder getQueryBuilder()

      Description copied from class: `TermFilteredPresearcher`
      Returns a `TermFilteredPresearcher.DocumentQueryBuilder` for this presearcher
      Overrides:
        `getQueryBuilder` in class `TermFilteredPresearcher`

    - #### buildQueryDocument

          public Document buildQueryDocument(QueryTree querytree)

      Description copied from class: `TermFilteredPresearcher`
      Builds a `Document` from the terms extracted from a query
      Overrides:
        `buildQueryDocument` in class `TermFilteredPresearcher`

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