Return docs most similar to query.
similarity_search(
self,
query: str,
k: int = 4,
filter: MetadataFilter | None = None,
search_params: models.SearchParams | None = None,
offset: int = 0,
score_threshold: float | None = None,
consistency: models.ReadConsistency | None = None,
**kwargs: Any = {}
) -> list[Document]| Name | Type | Description |
|---|---|---|
query* | str | Text to look up documents similar to. |
k | int | Default: 4Number of Documents to return. |
filter | MetadataFilter | None | Default: NoneFilter by metadata. |
search_params | models.SearchParams | None | Default: NoneAdditional search params |
offset | int | Default: 0Offset of the first result to return. May be used to paginate results. Note: large offset values may cause performance issues. |
score_threshold | float | None | Default: NoneDefine a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned. |
consistency | models.ReadConsistency | None | Default: NoneRead consistency of the search. Defines how many replicas should be queried before returning the result. Values:
|
**kwargs | Any | Default: {}Any other named arguments to pass through to QdrantClient.search() |