search

Function

Retrieves vectors in a database that are similar to the passed vectors.

Prototype

@abstractmethod
def search(embeddings, k, filter_dict)

Parameters

Parameter

Data Type

Required/Optional

Description

embeddings

Union[List[List[float], List[Dict[int, float]]]

Required

Vector object to be retrieved, which can be a dense vector or sparse vector.

k

Integer

Optional

Number of returned similar vectors.

filter_dict

Dict

Optional

Dictionary consisting of retrieval criteria. Currently, only document IDs can be filtered. The filtered document IDs are passed in a list. The length of the ID list cannot exceed 1000 × 1000. For example, if you need to filter the documents whose IDs are 1, 2, and 4, the input dictionary is {"document_id": [1, 2, 4]}.