Class CheckHits.ExplanationAssertingSearcher
- java.lang.Object
-
- org.apache.lucene.search.Searcher
-
- org.apache.lucene.search.IndexSearcher
-
- org.apache.lucene.search.CheckHits.ExplanationAssertingSearcher
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Searchable
- Enclosing class:
- CheckHits
public static class CheckHits.ExplanationAssertingSearcher extends IndexSearcher
an IndexSearcher that implicitly checks hte explanation of every match whenever it executes a search.- See Also:
CheckHits.ExplanationAsserter
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.search.IndexSearcher
docStarts, subReaders, subSearchers
-
-
Constructor Summary
Constructors Constructor Description ExplanationAssertingSearcher(IndexReader r)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkExplanations(Query q)
void
search(Query query, Collector results)
Lower-level search API.TopDocs
search(Query query, Filter filter, int n)
Finds the topn
hits forquery
, applyingfilter
if non-null.TopFieldDocs
search(Query query, Filter filter, int n, Sort sort)
Search implementation with arbitrary sorting.void
search(Query query, Filter filter, Collector results)
Lower-level search API.-
Methods inherited from class org.apache.lucene.search.IndexSearcher
close, createNormalizedWeight, doc, doc, docFreq, explain, explain, gatherSubReaders, getIndexReader, getSimilarity, getSubReaders, maxDoc, rewrite, search, search, search, search, search, search, search, searchAfter, searchAfter, setDefaultFieldSortScoring, setSimilarity, toString
-
Methods inherited from class org.apache.lucene.search.Searcher
createWeight, docFreqs
-
-
-
-
Constructor Detail
-
ExplanationAssertingSearcher
public ExplanationAssertingSearcher(IndexReader r) throws IOException
- Throws:
IOException
-
-
Method Detail
-
checkExplanations
protected void checkExplanations(Query q) throws IOException
- Throws:
IOException
-
search
public TopFieldDocs search(Query query, Filter filter, int n, Sort sort) throws IOException
Description copied from class:IndexSearcher
Search implementation with arbitrary sorting. Finds the topn
hits forquery
, applyingfilter
if non-null, and sorting the hits by the criteria insort
.NOTE: this does not compute scores by default; use
IndexSearcher.setDefaultFieldSortScoring(boolean, boolean)
to enable scoring.- Overrides:
search
in classIndexSearcher
- Throws:
IOException
-
search
public void search(Query query, Collector results) throws IOException
Description copied from class:IndexSearcher
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, int)
) is usually more efficient, as it skips non-high-scoring hits.Note: The
score
passed to this method is a raw score. In other words, the score will not necessarily be a float whose value is between 0 and 1.- Overrides:
search
in classIndexSearcher
- Throws:
IOException
-
search
public void search(Query query, Filter filter, Collector results) throws IOException
Description copied from class:IndexSearcher
Lower-level search API.Collector.collect(int)
is called for every matching document.
Collector-based access to remote indexes is discouraged.Applications should only use this if they need all of the matching documents. The high-level search API (
Searcher.search(Query, Filter, int)
) is usually more efficient, as it skips non-high-scoring hits.- Overrides:
search
in classIndexSearcher
- Parameters:
query
- to match documentsfilter
- if non-null, used to permit documents to be collected.results
- to receive hits- Throws:
IOException
-
search
public TopDocs search(Query query, Filter filter, int n) throws IOException
Description copied from class:IndexSearcher
Finds the topn
hits forquery
, applyingfilter
if non-null.- Overrides:
search
in classIndexSearcher
- Throws:
IOException
-
-