Package com.redis.vl.utils.rerank
Class RerankResult
java.lang.Object
com.redis.vl.utils.rerank.RerankResult
Result from a reranking operation containing reranked documents and optional scores.
This class encapsulates the output of a reranker, which includes the reordered documents and their relevance scores (if requested).
-
Constructor Summary
ConstructorsConstructorDescriptionRerankResult
(List<?> documents, List<Double> scores) Create a rerank result with documents and scores. -
Method Summary
-
Constructor Details
-
RerankResult
Create a rerank result with documents and scores.- Parameters:
documents
- The reranked documents (either List<String> or List<Map<String, Object>>)scores
- The relevance scores for each document, or null if scores were not requested- Throws:
IllegalArgumentException
- if documents is null, or if scores is non-null but has a different size than documents
-
-
Method Details
-
getDocuments
Get the reranked documents.- Returns:
- Immutable list of reranked documents
-
getScores
Get the relevance scores for each document.- Returns:
- Immutable list of scores, or null if scores were not requested
-
hasScores
public boolean hasScores()Check if this result includes scores.- Returns:
- true if scores are included, false otherwise
-
getTopScore
public double getTopScore()Get the highest score from the result.- Returns:
- The maximum score
- Throws:
IllegalStateException
- if no scores are available or if the score list is empty
-
toString
-