org.apache.lucene.search

## Class ParallelMultiSearcher

- java.lang.Object
- - org.apache.lucene.search.Searcher
  - - org.apache.lucene.search.MultiSearcher
    - - org.apache.lucene.search.ParallelMultiSearcher

- All Implemented Interfaces:
    Searchable

      public class ParallelMultiSearcher
      extends MultiSearcher

  Implements parallel search over a set of `Searchables`.

  Applications usually need only call the inherited `Searcher.search(Query)` or `Searcher.search(Query,Filter)` methods.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ParallelMultiSearcher(Searchable[] searchables)` Creates a searchable which searches searchables.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `docFreq(Term term)` TODO: parallelize this one too
    `Query` | `rewrite(Query original)` Expert: called to re-write queries into primitive queries.
    `void` | `search(Weight weight, Filter filter, Collector collector)` Lower-level search API.
    `TopDocs` | `search(Weight weight, Filter filter, int nDocs)` A search implementation which spans a new thread for each Searchable, waits for each search to complete and merge the results back together.
    `TopFieldDocs` | `search(Weight weight, Filter filter, int nDocs, Sort sort)` A search implementation allowing sorting which spans a new thread for each Searchable, waits for each search to complete and merges the results back together.

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

      `close, createWeight, doc, doc, explain, getSearchables, getStarts, maxDoc, subDoc, subSearcher`

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

      `docFreqs, explain, getSimilarity, search, search, search, search, search, search, search, search, search, search, search, search, setSimilarity`

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

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

- - ### Constructor Detail

    - #### ParallelMultiSearcher

          public ParallelMultiSearcher(Searchable[] searchables)
                                throws java.io.IOException

      Creates a searchable which searches searchables.
      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### docFreq

          public int docFreq(Term term)
                      throws java.io.IOException

      TODO: parallelize this one too
      Specified by:
        `docFreq` in interface `Searchable`
      Overrides:
        `docFreq` in class `MultiSearcher`
      Throws:
        `java.io.IOException`
      See Also:
        `IndexReader.docFreq(Term)`

    - #### search

          public TopDocs search(Weight weight,
                                Filter filter,
                                int nDocs)
                         throws java.io.IOException

      A search implementation which spans a new thread for each Searchable, waits for each search to complete and merge the results back together.
      Specified by:
        `search` in interface `Searchable`
      Overrides:
        `search` in class `MultiSearcher`
      Throws:
        `java.io.IOException`

    - #### search

          public TopFieldDocs search(Weight weight,
                                     Filter filter,
                                     int nDocs,
                                     Sort sort)
                              throws java.io.IOException

      A search implementation allowing sorting which spans a new thread for each Searchable, waits for each search to complete and merges the results back together.
      Specified by:
        `search` in interface `Searchable`
      Overrides:
        `search` in class `MultiSearcher`
      Throws:
        `java.io.IOException`

    - #### search

          public void search(Weight weight,
                             Filter filter,
                             Collector collector)
                      throws java.io.IOException

      Lower-level search API.

      `Collector.collect(int)` is called for every matching document.

      Applications should only use this if they need all of the matching documents. The high-level search API (`Searcher.search(Query)`) is usually more efficient, as it skips non-high-scoring hits.

      Specified by:
        `search` in interface `Searchable`
      Overrides:
        `search` in class `MultiSearcher`
      Parameters:
        `weight` - to match documents
        `filter` - if non-null, a bitset used to eliminate some documents
        `collector` - to receive hits TODO: parallelize this one too
      Throws:
        `java.io.IOException`

    - #### rewrite

          public Query rewrite(Query original)
                        throws java.io.IOException

      Description copied from interface: `Searchable`
      Expert: called to re-write queries into primitive queries.
      Specified by:
        `rewrite` in interface `Searchable`
      Overrides:
        `rewrite` in class `MultiSearcher`
      Throws:
        `java.io.IOException`

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