Class Store.ChunkResult
java.lang.Object
com.oracle.coherence.rag.api.Store.ChunkResult
- Enclosing class:
Store
Represents a search result containing a document chunk with relevance score.
This class encapsulates a document chunk that matched a search query, including its content, relevance score, and the index type used for retrieval. It supports results from both vector similarity search and full-text search.
- Since:
- 25.09
- Author:
- Aleks Seovic 2025.07.04
-
Constructor Summary
ConstructorsConstructorDescriptionChunkResult(com.oracle.coherence.ai.QueryResult<com.oracle.coherence.ai.DocumentChunk.Id, com.oracle.coherence.ai.DocumentChunk> result) Creates a chunk result from a Lucene query result.ChunkResult(dev.langchain4j.store.embedding.EmbeddingMatch<dev.langchain4j.data.segment.TextSegment> match) Creates a chunk result from an embedding store match. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the unique identifier for this chunk.getIndex()Gets the index type used to retrieve this chunk.doublegetScore()Gets the relevance score for this chunk.getText()Gets the text content of this chunk.inthashCode()Sets the index type for this chunk.setScore(double score) Sets the relevance score for this chunk.toString()
-
Constructor Details
-
ChunkResult
public ChunkResult(dev.langchain4j.store.embedding.EmbeddingMatch<dev.langchain4j.data.segment.TextSegment> match) Creates a chunk result from an embedding store match.This constructor is used for results from vector similarity search.
- Parameters:
match- the embedding match containing chunk and similarity score
-
ChunkResult
public ChunkResult(com.oracle.coherence.ai.QueryResult<com.oracle.coherence.ai.DocumentChunk.Id, com.oracle.coherence.ai.DocumentChunk> result) Creates a chunk result from a Lucene query result.This constructor is used for results from full-text search.
- Parameters:
result- the query result containing chunk and relevance score
-
-
Method Details
-
getChunkId
-
getScore
public double getScore()Gets the relevance score for this chunk.- Returns:
- the relevance score (0.0 to 1.0)
-
setScore
Sets the relevance score for this chunk.This method is used during result processing and re-ranking.
- Parameters:
score- the new relevance score- Returns:
- this ChunkResult for method chaining
-
getIndex
Gets the index type used to retrieve this chunk.- Returns:
- the index type (e.g., "VECTOR", "FULL_TEXT")
-
setIndex
Sets the index type for this chunk.This method is used to track which search method produced this result.
- Parameters:
index- the index type- Returns:
- this ChunkResult for method chaining
-
getText
-
equals
-
hashCode
-
toString
-