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 classAQuerythat matches only the specifiedRankDoc, using the providedQuerysources 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 aRankDocsQuerybased on the provided docs. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.lucene.search.WeightcreateWeight(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.ScoreMode scoreMode, float boost) booleaninthashCode()RankDoc[]rankDocs()org.apache.lucene.search.Queryrewrite(org.apache.lucene.search.IndexSearcher searcher) voidvisit(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 aRankDocsQuerybased 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:
rewritein 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:
createWeightin classorg.apache.lucene.search.Query- Throws:
IOException
-
toString
- Specified by:
toStringin classorg.apache.lucene.search.Query
-
visit
public void visit(org.apache.lucene.search.QueryVisitor visitor) - Specified by:
visitin classorg.apache.lucene.search.Query
-
equals
- Specified by:
equalsin classorg.apache.lucene.search.Query
-
hashCode
public int hashCode()- Specified by:
hashCodein classorg.apache.lucene.search.Query
-