Document Scores
Understanding relevance scores in search results
Document Scores
When retrieving documents from an index, Ducky returns relevance scores alongside the documents and chunks. These scores help you understand how well each document matches your search query.
What are Scores?
Scores are integer values between 0 and 1000 that indicate how relevant a document is to your search query. A higher score means the document is more relevant to your query. The scores are returned as a mapping from doc_id
to their corresponding relevance scores.
How Scores are Calculated
The score calculation depends on whether reranking is enabled in your retrieval request:
Without Reranking: For each document, the system takes the highest confidence score among all its chunks that match your query. This means if a document has multiple relevant chunks, only the most relevant chunk's score is used as the document's overall score.
With Reranking: When reranking is enabled, the system uses a more sophisticated reranking model to provide more accurate relevance scores. Each document receives a single reranked score based on its overall relevance to the query.
Using Scores in Your Application
Scores are returned in the scores
field of the retrieve documents response and can be used to:
- Rank results: Sort documents by their relevance scores to show the most relevant content first
- Filter results: Set a minimum score threshold to only show highly relevant documents
- Provide confidence indicators: Display score-based confidence levels to users (e.g., "High relevance" for scores > 800)
The scores are automatically calculated and returned whenever you retrieve documents using the /v1/documents/retrieve
endpoint, giving you immediate insight into the relevance of your search results.
Updated about 13 hours ago