refactor: update the default values of top-k parameter in vdb to be consistent (#9367)

This commit is contained in:
zhuhao
2024-10-16 16:00:21 +08:00
committed by GitHub
parent a83ccccffc
commit 86594851cb
9 changed files with 9 additions and 29 deletions

View File

@@ -112,7 +112,7 @@ class ElasticSearchVector(BaseVector):
self._client.indices.delete(index=self._collection_name)
def search_by_vector(self, query_vector: list[float], **kwargs: Any) -> list[Document]:
top_k = kwargs.get("top_k", 10)
top_k = kwargs.get("top_k", 4)
num_candidates = math.ceil(top_k * 1.5)
knn = {"field": Field.VECTOR.value, "query_vector": query_vector, "k": top_k, "num_candidates": num_candidates}