Module org.elasticsearch.server
Class RankDocsQuery
java.lang.Object
org.apache.lucene.search.Query
org.elasticsearch.search.retriever.rankdoc.RankDocsQuery
public class RankDocsQuery
extends org.apache.lucene.search.Query
A
RankDocsQuery
returns the top k documents in the order specified by the global doc IDs.
This is used by retrievers that compute a score for a large document set, and need access to just the top results,
after performing any reranking or filtering.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
AQuery
that matches only the specifiedRankDoc
, using the providedQuery
sources solely for the purpose of explainability. -
Constructor Summary
ConstructorsConstructorDescriptionRankDocsQuery
(org.apache.lucene.index.IndexReader reader, RankDoc[] rankDocs, org.apache.lucene.search.Query[] sources, String[] queryNames, boolean onlyRankDocs) Creates aRankDocsQuery
based on the provided docs. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.lucene.search.Weight
createWeight
(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.ScoreMode scoreMode, float boost) boolean
int
hashCode()
RankDoc[]
rankDocs()
org.apache.lucene.search.Query
rewrite
(org.apache.lucene.search.IndexSearcher searcher) void
visit
(org.apache.lucene.search.QueryVisitor visitor) Methods inherited from class org.apache.lucene.search.Query
classHash, sameClassAs, toString
-
Constructor Details
-
RankDocsQuery
public RankDocsQuery(org.apache.lucene.index.IndexReader reader, RankDoc[] rankDocs, org.apache.lucene.search.Query[] sources, String[] queryNames, boolean onlyRankDocs) Creates aRankDocsQuery
based on the provided docs.- Parameters:
rankDocs
- The global doc IDs of documents that match, in ascending ordersources
- The original queries that were used to compute the top documentsqueryNames
- The names (if present) of the original retrieversonlyRankDocs
- Whether the query should only match the provided rank docs
-
-
Method Details
-
rankDocs
-
rewrite
public org.apache.lucene.search.Query rewrite(org.apache.lucene.search.IndexSearcher searcher) throws IOException - Overrides:
rewrite
in classorg.apache.lucene.search.Query
- Throws:
IOException
-
createWeight
public org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.ScoreMode scoreMode, float boost) throws IOException - Overrides:
createWeight
in classorg.apache.lucene.search.Query
- Throws:
IOException
-
toString
- Specified by:
toString
in classorg.apache.lucene.search.Query
-
visit
public void visit(org.apache.lucene.search.QueryVisitor visitor) - Specified by:
visit
in classorg.apache.lucene.search.Query
-
equals
- Specified by:
equals
in classorg.apache.lucene.search.Query
-
hashCode
public int hashCode()- Specified by:
hashCode
in classorg.apache.lucene.search.Query
-