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, boolean backfillResults) Creates an in-memory index of chunks, or chunks, returns ordered, scored list.toString()
-
Constructor Details
-
MemoryIndexChunkScorer
public MemoryIndexChunkScorer()
-
-
Method Details
-
scoreChunks
public List<MemoryIndexChunkScorer.ScoredChunk> scoreChunks(List<String> chunks, String inferenceText, int maxResults, boolean backfillResults) 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 returnbackfillResults- If true, backfills no matches with the first chunks in the list with scores of 0.- Returns:
- list of scored chunks ordered by relevance
- Throws:
ElasticsearchException- on failure scoring chunks
-
toString
-