Hi guys, is there anyway to get Node in vectorstore or vector index when metadata is known in advance? My case is i have metadata is a link (and it known in advance) and i want get all Node with this metadata (get Node for pass it in my customQueryEngine).
here is example what i want:
# Load the storage context
index = vin_retriever.index
list_link = ['https://www.vinmec.com/vi/tin-tuc/5-dieu-can-biet-ve-viem-phoi-cap-do-virus-corona/','https://www.vinmec.com/vi/tin-tuc/5-dieu-can-biet-ve-viem-phoi-cap-do-virus-corona/']
node_list =[]
# Iterate over all nodes in the storage context
for node in index.vector_store.nodes:
if node.metadata['url'] in list_link:
node_list.append(node)
Another way i found is using MetadataFilters but i can't match Filter with multi value with same key (work with 1 filter, not with multi):
filters = MetadataFilters(
filters=[
ExactMatchFilter(key="url", value=list_link[1]),
ExactMatchFilter(key="url", value=list_link[0]),
ExactMatchFilter(key="url", value=list_link[2]),
# Add more filters as needed
]
)
# Get the retriever with the filters
retriever = index.as_retriever(filters=filters)
Any idea? please