From d40f6036da5b3f5a60ae6f8fc0a43c8b8e4b46c3 Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Wed, 5 Nov 2025 10:30:44 +0300 Subject: [PATCH] Features:; Fixes: 1) Correct type and structure for `uuids_by_index` dictionary values; 2) Remove unnecessary dictionary wrapping for UUID values in `uuids_by_index`; Extra: Simplify UUID appending logic for `meta.index` values. --- core/elasticsearch/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/elasticsearch/__init__.py b/core/elasticsearch/__init__.py index 3a6493ae..9ed5ff22 100644 --- a/core/elasticsearch/__init__.py +++ b/core/elasticsearch/__init__.py @@ -228,7 +228,7 @@ def process_query( resp_products = search_products.execute() results: dict[str, list[dict[str, Any]]] = {"products": [], "categories": [], "brands": [], "posts": []} - uuids_by_index: dict[str, list[dict[str, Any]]] = {"products": [], "categories": [], "brands": []} + uuids_by_index: dict[str, list[str]] = {"products": [], "categories": [], "brands": []} hit_cache: list[Any] = [] seen_keys: set[tuple[str, str]] = set() @@ -244,7 +244,7 @@ def process_query( hit_cache.append(hh) seen_keys.add(key) if getattr(hh, "uuid", None): - uuids_by_index.setdefault(hh.meta.index, []).append({"uuid": str(hh.uuid)}) + uuids_by_index.setdefault(hh.meta.index, []).append(str(hh.uuid)) exact_queries_by_index: dict[str, list[Any]] = { "categories": [ @@ -299,7 +299,7 @@ def process_query( hit_cache.append(h) seen_keys.add(k) if getattr(h, "uuid", None): - uuids_by_index.setdefault(h.meta.index, []).append({"uuid": str(h.uuid)}) + uuids_by_index.setdefault(h.meta.index, []).append(str(h.uuid)) products_by_uuid = {} brands_by_uuid = {}