Creates a new KeywordFallback instance.
The corpus chunks to search over.
Searches the corpus for chunks matching the given query keywords.
Scoring algorithm:
The user query string to match.
Maximum number of results to return. Defaults to 5.
Array of RetrievedChunk sorted by relevance, at most topK entries.
Simple keyword-matching search over a corpus of chunks.
Used as a degraded-mode fallback when the embedding API is unavailable. Splits the query into keywords, filters out stop words and short tokens, then scores each chunk by the number of keyword hits (heading matches receive a higher weight than content matches).
Example