File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
extensions/src/main/java/com/fpf/smartscansdk/extensions/embeddings Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,9 @@ class FileEmbeddingRetriever(
1919
2020 cachedIds = null // clear on new search
2121
22- val storedEmbeddings = store.getAll ()
22+ val storedEmbeddings = store.get ()
2323
24- if (storedEmbeddings.isEmpty
25- ()) return emptyList()
24+ if (storedEmbeddings.isEmpty()) return emptyList()
2625
2726 val similarities = getSimilarities(embedding, storedEmbeddings.map { it.embeddings })
2827 val resultIndices = getTopN(similarities, topK, threshold)
@@ -37,5 +36,15 @@ class FileEmbeddingRetriever(
3736 cachedIds = idsToCache
3837 return results
3938 }
39+
40+ suspend fun query (start : Int , end : Int ): List <Embedding > {
41+ val ids = cachedIds ? : return emptyList()
42+ val s = start.coerceAtLeast(0 )
43+ val e = end.coerceAtMost(ids.size)
44+ if (s >= e) return emptyList()
45+
46+ val batch = store.get(ids)
47+ return batch
48+ }
4049}
4150
You can’t perform that action at this time.
0 commit comments