我想通过根据我存储在元数据中的日期进行过滤来限制 chromaDB 查询期间的搜索。我只想搜索两个日期之间的文档。我尝试了以下条件 -
results = collection.query(
query_embeddings=query_embedding,
n_results=5,
where={"timestamp":
{"$lte":datetime.strptime('2024-01-10',"%Y-%m-%d").timestamp(),
"$gte":datetime.strptime('2024-01-01',"%Y-%m-%d").timestamp()}},
)
有人可以告诉我哪里出错了吗?
弄清楚了如何构造 where 子句 -
where = {'$and':[{'timestamp':{"$gte":start_timestamp}}, {'timestamp':{"$lte":end_timestamp}}]}
这有效。