Skip to content

Commit 443362c

Browse files
authored
Add the approximate threshold parameter to search (#288)
1 parent b0af4db commit 443362c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/marqo/index.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ def search(self, q: Optional[Union[str, dict]] = None, searchable_attributes: Op
224224
text_query_prefix: Optional[str] = None, hybrid_parameters: Optional[dict] = None,
225225
rerank_depth: Optional[int] = None, facets: Optional[dict] = None,
226226
track_total_hits: Optional[bool] = None,
227+
approximate_threshold: Optional[float] = None,
227228
) -> Dict[str, Any]:
228229
"""Search the index.
229230
@@ -264,6 +265,10 @@ def search(self, q: Optional[Union[str, dict]] = None, searchable_attributes: Op
264265
rerank_depth: The number of documents to rerank with score modifiers if used with hybrid search.
265266
Number of hits to get from each shard if used with tensor search.
266267
facets: a dictionary of facets to be used for facet search.
268+
track_total_hits: return total number of lexical matches
269+
approximate_threshold: hit ratio threshold for deciding if a nearest neighbor search should be performed as
270+
an exact search, rather than an approximate search
271+
267272
Returns:
268273
Dictionary with hits and other metadata
269274
"""
@@ -289,6 +294,7 @@ def search(self, q: Optional[Union[str, dict]] = None, searchable_attributes: Op
289294
"modelAuth": model_auth,
290295
"efSearch": ef_search,
291296
"approximate": approximate,
297+
"approximateThreshold": approximate_threshold,
292298
"searchableAttributes": searchable_attributes,
293299
"limit": limit,
294300
"offset": offset,
@@ -455,7 +461,6 @@ def embed(self, content: Union[Union[str, Dict[str, float]], List[Union[str, Dic
455461
body["imageDownloadHeaders"] = image_download_headers
456462
if model_auth is not None:
457463
body["modelAuth"] = model_auth
458-
459464

460465
res = self.http.post(
461466
path=path_with_query_str,

0 commit comments

Comments
 (0)