org.apache.lucene.search

## Class AssertingIndexSearcher

- java.lang.Object
- - org.apache.lucene.search.IndexSearcher
  - - org.apache.lucene.search.AssertingIndexSearcher

-     public class AssertingIndexSearcher
      extends IndexSearcher

  Helper class that adds some extra checks to ensure correct usage of `IndexSearcher` and `Weight`.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.lucene.search.IndexSearcher

      `IndexSearcher.LeafSlice`

  - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.search.IndexSearcher

      `leafContexts, leafSlices, readerContext`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AssertingIndexSearcher(Random random, IndexReader r)`
    `AssertingIndexSearcher(Random random, IndexReaderContext context)`
    `AssertingIndexSearcher(Random random, IndexReaderContext context, ExecutorService ex)`
    `AssertingIndexSearcher(Random random, IndexReader r, ExecutorService ex)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Weight` | `createNormalizedWeight(Query query, boolean needsScores)` Ensures, that the returned `Weight` is not normalized again, which may produce wrong scores.
    `Weight` | `createWeight(Query query, boolean needsScores)`
    `Query` | `rewrite(Query original)`
    `protected void` | `search(List<LeafReaderContext> leaves, Weight weight, Collector collector)`
    `String` | `toString()`

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

      `collectionStatistics, count, doc, doc, doc, explain, explain, getDefaultQueryCache, getDefaultQueryCachingPolicy, getDefaultSimilarity, getIndexReader, getQueryCache, getQueryCachingPolicy, getSimilarity, getTopReaderContext, search, search, search, search, search, searchAfter, searchAfter, searchAfter, setDefaultQueryCache, setDefaultQueryCachingPolicy, setQueryCache, setQueryCachingPolicy, setSimilarity, slices, termStatistics`

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

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

- - ### Constructor Detail

    - #### AssertingIndexSearcher

          public AssertingIndexSearcher(Random random,
                                        IndexReader r)

    - #### AssertingIndexSearcher

          public AssertingIndexSearcher(Random random,
                                        IndexReaderContext context)

    - #### AssertingIndexSearcher

          public AssertingIndexSearcher(Random random,
                                        IndexReader r,
                                        ExecutorService ex)

    - #### AssertingIndexSearcher

          public AssertingIndexSearcher(Random random,
                                        IndexReaderContext context,
                                        ExecutorService ex)

  - ### Method Detail

    - #### createNormalizedWeight

          public Weight createNormalizedWeight(Query query,
                                               boolean needsScores)
                                        throws IOException

      Ensures, that the returned `Weight` is not normalized again, which may produce wrong scores.
      Overrides:
        `createNormalizedWeight` in class `IndexSearcher`
      Throws:
        `IOException`

    - #### createWeight

          public Weight createWeight(Query query,
                                     boolean needsScores)
                              throws IOException

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

    - #### rewrite

          public Query rewrite(Query original)
                        throws IOException

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

    - #### search

          protected void search(List<LeafReaderContext> leaves,
                                Weight weight,
                                Collector collector)
                         throws IOException

      Overrides:
        `search` in class `IndexSearcher`
      Throws:
        `IOException`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `IndexSearcher`

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