Package com.tnsai.server.rag.retrieval
Class BM25Stream
java.lang.Object
com.tnsai.server.rag.retrieval.BM25Stream
- All Implemented Interfaces:
RetrievalStream
BM25-based keyword retrieval, bounded by a Caffeine LRU cache (issue #36).
See the issue for rationale; the index is now a bounded LRU window rather
than a complete in-memory index.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDocument(com.tnsai.knowledge.Document doc) voidclear()intname()voidremoveDocument(String docId) voidreplaceDocuments(Collection<String> removeIds, List<com.tnsai.knowledge.Document> add) Removes then adds documents as one generation under the index lock.List<com.tnsai.knowledge.SearchResult> longsize()Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tnsai.server.rag.retrieval.RetrievalStream
isAvailable
-
Field Details
-
DEFAULT_MAXIMUM_SIZE
public static final int DEFAULT_MAXIMUM_SIZE- See Also:
-
DEFAULT_EXPIRE_AFTER_ACCESS
-
-
Constructor Details
-
BM25Stream
public BM25Stream() -
BM25Stream
-
-
Method Details
-
name
- Specified by:
namein interfaceRetrievalStream
-
getMaximumSize
public int getMaximumSize() -
size
public long size() -
addDocument
public void addDocument(com.tnsai.knowledge.Document doc) -
removeDocument
-
replaceDocuments
Removes then adds documents as one generation under the index lock.- Parameters:
removeIds- document identifiers to dropadd- documents to index after the removals
-
clear
public void clear() -
retrieve
- Specified by:
retrievein interfaceRetrievalStream
-