From e288b7bd3598c21d66829d1faacbeba453b8029c Mon Sep 17 00:00:00 2001 From: davidmezzetti <561939+davidmezzetti@users.noreply.github.com> Date: Sun, 5 Feb 2023 19:13:07 -0500 Subject: [PATCH] Update parameter order in API.search --- src/python/txtai/api/base.py | 2 +- src/python/txtai/api/routers/embeddings.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/txtai/api/base.py b/src/python/txtai/api/base.py index df004e7bd..404dae47b 100644 --- a/src/python/txtai/api/base.py +++ b/src/python/txtai/api/base.py @@ -23,7 +23,7 @@ def __init__(self, config, loaddata=True): self.cluster = Cluster(self.config["cluster"]) # pylint: disable=W0221 - def search(self, query, request=None, limit=None): + def search(self, query, limit=None, request=None): # When search is invoked via the API, limit is set from the request # When search is invoked directly, limit is set using the method parameter limit = self.limit(request.query_params.get("limit") if request and hasattr(request, "query_params") else limit) diff --git a/src/python/txtai/api/routers/embeddings.py b/src/python/txtai/api/routers/embeddings.py index 84295daa4..c40608e66 100644 --- a/src/python/txtai/api/routers/embeddings.py +++ b/src/python/txtai/api/routers/embeddings.py @@ -27,7 +27,7 @@ def search(query: str, request: Request): list of {id: value, score: value} """ - return application.get().search(query, request) + return application.get().search(query, request=request) @router.post("/batchsearch")