Find answers from the community

Updated 9 months ago

Hi. I need to query index with many

Hi. I need to query index with many queries each time using different metadata filters ( date). Should I instantiate new query engine (as_query_engine) for each query with a different metadata filter?
L
S
4 comments
Yea thats fine -- creating a query engine is essentially a no-op
Actually , I found out that I can just reassign filters before each query
def query_with_time(engine, query, ds):
engine._retriever._filter=MetadataFilters(filters=[MetadataFilter(key="date", operator=FilterOperator.LT,value=ds.timestamp())])
return engine.query(query)
Add a reply
Sign up and join the conversation on Discord