目录
向量搜索、标量查询、获取 Entity
向量搜索、标量查询及通过 ID 获取 Entity 是三种不同的操作。
- 向量搜索是指进行近似最近邻(ANN)搜索。
- 标量查询是指根据特定条件查找匹配的数据。
- 获取 Entity 是指根据 ID 获取特定 Entity。
向量搜索(ANN 搜索)
示例数据集中的 vector 字段包含了由每篇文章标题转化而来的向量。以下示例展示如何对向量数据进行 ANN 搜索,从而找到与查询标题含义最相似的文章标题。
- Python
- NodeJS
with open("path/to/downloaded/medium_articles_2020_dpr.json") as f: data = json.load(f) res = client.search( collection_name="medium_articles_2020", data=[data["rows"][0]["title_vector"]], output_fields=["title"] ) print