Skip to content

Commit

Permalink
avoid search lookup in find_one call (#2511)
Browse files Browse the repository at this point in the history
* avoid search lookup in find_one call

* fix tests
  • Loading branch information
petrjasek authored Jan 22, 2024
1 parent af81bd5 commit 00d3af0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion superdesk/eve_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def find_one(self, endpoint_name, req, **lookup):
backend = self._backend(endpoint_name)
item = backend.find_one(endpoint_name, req=req, **lookup)
search_backend = self._lookup_backend(endpoint_name, fallback=True)
if search_backend:
if search_backend and app.config.get("BACKEND_FIND_ONE_SEARCH_TEST", False):
# set the parent for the parent child in elastic search
self._set_parent(endpoint_name, item, lookup)
item_search = search_backend.find_one(endpoint_name, req=req, **lookup)
Expand Down
4 changes: 4 additions & 0 deletions superdesk/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ def update_config(conf):

# auth server
conf["AUTH_SERVER_SHARED_SECRET"] = "some secret"

# todo: only activate it for specific tests
conf["BACKEND_FIND_ONE_SEARCH_TEST"] = True

return conf


Expand Down

0 comments on commit 00d3af0

Please sign in to comment.