Module org.elasticsearch.xcore
Class MemoryIndexChunkScorer
java.lang.Object
org.elasticsearch.xpack.core.common.chunks.MemoryIndexChunkScorer
Utility class for scoring pre-determined chunks using an in-memory Lucene index.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a chunk with its relevance score. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionscoreChunks(List<String> chunks, String inferenceText, int maxResults) Creates an in-memory index of chunks, or chunks, returns ordered, scored list.
-
Constructor Details
-
MemoryIndexChunkScorer
public MemoryIndexChunkScorer()
-
-
Method Details
-
scoreChunks
public List<MemoryIndexChunkScorer.ScoredChunk> scoreChunks(List<String> chunks, String inferenceText, int maxResults) throws IOException Creates an in-memory index of chunks, or chunks, returns ordered, scored list.- Parameters:
chunks- the list of text chunks to scoreinferenceText- the query text to compare againstmaxResults- maximum number of results to return- Returns:
- list of scored chunks ordered by relevance
- Throws:
IOException- on failure scoring chunks
-