Find answers from the community

Updated last year

Docs

Hiya! If I have a VectorStoreIndex of chunked documentation pages, how would I implement a "related pages" search where a filename (that is part of the index) is given as input and the filenames that are associated with semantically related chunks in the same index are returned as output? (The index was created with filename_as_id=True.)
L
r
2 comments
Hmm not sure I completely follow

You can check the source nodes based on a query, and then report back which files they came from

Plain Text
response = query_engine.query(query_str)

print(response.source_nodes[0].node.ref_doc_id)
I guess I'm not sure what to use for query_str when it's the whole doc (and all its chunks) that I want to compare to all the other docs (and all their chunks) in the index. Maybe I should just use the title of the doc as the query or a summary of the doc?
Add a reply
Sign up and join the conversation on Discord