Find answers from the community

Updated 2 months ago

is it possible to list how many nodes in

is it possible to list how many nodes in a vector store belongs to a specific document ?
W
h
3 comments
If record is a PDF, it stores filename in the metadata, you can check for the filename and do a iteration on all the nodes and add count if same filename is found.

If you are creating a document by yourself, then you can put same ID in all the document for same type. And then follow the same approach to find similar nodes.
to give some context, iam using the redis fullstack example, and iam looking to do something like this:

lets say i have 2 documents
document 1 -> 1000 nodes
document 2 -> 100nodes

retrival of topK 1000 =
100 nodes from Document 1
40 Nodes from document 2

i want to select the file that has a bigger percentage hit
Document 1 relevance = 100/ 1000
Document 2 relevance = 40 / 100

then i do my query on a topK filtered on the most relevant file..

maybe iam tackling this the wron way
for future refrence:

**import re import redis # Connect to Redis r = redis.Redis(host=REDIS_HOST, port=6379, db=0) # Perform search # Define your search query String = re.escape('Boston.txt') query = f"FT.SEARCH redis_vector_store '@file_name:{{{String}}}' return 0" # Execute the search command results = r.execute_command(query) print (results[0])**
Add a reply
Sign up and join the conversation on Discord