Replies: 3 comments
-
To be more precise, assuming I already have the documents indexed, I would llike to do a query on a subset of them without doing the full ingestion process. |
Beta Was this translation helpful? Give feedback.
-
I solved this by clone the vector store (fromDict, toDict), then selectively calling deleting on the unwanted docs. // get all documents
const docs = await storageContext.docStore.getAllRefDocInfo()
// reload vector store, no fs connection
const vectorStore = await SimpleVectorStore.fromDict(
await (
await SimpleVectorStore.fromPersistDir(persistDir)
).toDict()
)
// remove uneeded documents
const toRemove = Object.keys(docs).filter(
(id) => !files.includes(id)
)
for (const doc of toRemove) vectorStore.delete(doc)
// swap in storateContext
storageContext.vectorStore = vectorStore
`` |
Beta Was this translation helpful? Give feedback.
-
@pelikhan, what does your query look like? Seems like it would make sense to add a parameter to the query to filter for the subset of docs. |
Beta Was this translation helpful? Give feedback.
-
Hello all, I was looking for the best way to instantiate a document store loaded from disk, for a set of files.
Beta Was this translation helpful? Give feedback.
All reactions