Class ContextIndexSearcher

java.lang.Object
org.apache.lucene.search.IndexSearcher
org.elasticsearch.search.internal.ContextIndexSearcher
All Implemented Interfaces:
Closeable, AutoCloseable, org.elasticsearch.core.Releasable

public class ContextIndexSearcher extends org.apache.lucene.search.IndexSearcher implements org.elasticsearch.core.Releasable
Context-aware extension of IndexSearcher.
  • Nested Class Summary

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

    org.apache.lucene.search.IndexSearcher.LeafSlice
  • Field Summary

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

    leafContexts, readerContext
  • Constructor Summary

    Constructors
    Constructor
    Description
    ContextIndexSearcher(org.apache.lucene.index.IndexReader reader, org.apache.lucene.search.similarities.Similarity similarity, org.apache.lucene.search.QueryCache queryCache, org.apache.lucene.search.QueryCachingPolicy queryCachingPolicy, boolean wrapWithExitableDirectoryReader)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Add a Runnable that will be run on a regular basis while accessing documents in the DirectoryReader but also while collecting them and check for query cancellation or timeout.
    void
     
    org.apache.lucene.search.CollectionStatistics
     
    org.apache.lucene.search.Weight
    createWeight(org.apache.lucene.search.Query query, org.apache.lucene.search.ScoreMode scoreMode, float boost)
     
    org.apache.lucene.index.DirectoryReader
     
    boolean
     
    void
    Remove a Runnable that checks for query cancellation or timeout which is called while accessing documents in the DirectoryReader but also while collecting them.
    org.apache.lucene.search.Query
    rewrite(org.apache.lucene.search.Query original)
     
    void
    search(List<org.apache.lucene.index.LeafReaderContext> leaves, org.apache.lucene.search.Weight weight, org.apache.lucene.search.Collector collector)
     
    void
     
    void
     
    org.apache.lucene.search.TermStatistics
    termStatistics(org.apache.lucene.index.Term term, int docFreq, long totalTermFreq)
     

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

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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ContextIndexSearcher

      public ContextIndexSearcher(org.apache.lucene.index.IndexReader reader, org.apache.lucene.search.similarities.Similarity similarity, org.apache.lucene.search.QueryCache queryCache, org.apache.lucene.search.QueryCachingPolicy queryCachingPolicy, boolean wrapWithExitableDirectoryReader) throws IOException
      Throws:
      IOException
  • Method Details

    • setProfiler

      public void setProfiler(QueryProfiler profiler)
    • addQueryCancellation

      public Runnable addQueryCancellation(Runnable action)
      Add a Runnable that will be run on a regular basis while accessing documents in the DirectoryReader but also while collecting them and check for query cancellation or timeout.
    • removeQueryCancellation

      public void removeQueryCancellation(Runnable action)
      Remove a Runnable that checks for query cancellation or timeout which is called while accessing documents in the DirectoryReader but also while collecting them.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.elasticsearch.core.Releasable
    • hasCancellations

      public boolean hasCancellations()
    • setAggregatedDfs

      public void setAggregatedDfs(AggregatedDfs aggregatedDfs)
    • rewrite

      public org.apache.lucene.search.Query rewrite(org.apache.lucene.search.Query original) throws IOException
      Overrides:
      rewrite in class org.apache.lucene.search.IndexSearcher
      Throws:
      IOException
    • createWeight

      public org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.Query query, org.apache.lucene.search.ScoreMode scoreMode, float boost) throws IOException
      Overrides:
      createWeight in class org.apache.lucene.search.IndexSearcher
      Throws:
      IOException
    • search

      public void search(List<org.apache.lucene.index.LeafReaderContext> leaves, org.apache.lucene.search.Weight weight, org.apache.lucene.search.Collector collector) throws IOException
      Overrides:
      search in class org.apache.lucene.search.IndexSearcher
      Throws:
      IOException
    • termStatistics

      public org.apache.lucene.search.TermStatistics termStatistics(org.apache.lucene.index.Term term, int docFreq, long totalTermFreq) throws IOException
      Overrides:
      termStatistics in class org.apache.lucene.search.IndexSearcher
      Throws:
      IOException
    • collectionStatistics

      public org.apache.lucene.search.CollectionStatistics collectionStatistics(String field) throws IOException
      Overrides:
      collectionStatistics in class org.apache.lucene.search.IndexSearcher
      Throws:
      IOException
    • getDirectoryReader

      public org.apache.lucene.index.DirectoryReader getDirectoryReader()