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.
This commit is contained in:
parent
5ae69b5d05
commit
d40f6036da
1 changed files with 3 additions and 3 deletions
|
|
@ -228,7 +228,7 @@ def process_query(
|
||||||
resp_products = search_products.execute()
|
resp_products = search_products.execute()
|
||||||
|
|
||||||
results: dict[str, list[dict[str, Any]]] = {"products": [], "categories": [], "brands": [], "posts": []}
|
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] = []
|
hit_cache: list[Any] = []
|
||||||
|
|
||||||
seen_keys: set[tuple[str, str]] = set()
|
seen_keys: set[tuple[str, str]] = set()
|
||||||
|
|
@ -244,7 +244,7 @@ def process_query(
|
||||||
hit_cache.append(hh)
|
hit_cache.append(hh)
|
||||||
seen_keys.add(key)
|
seen_keys.add(key)
|
||||||
if getattr(hh, "uuid", None):
|
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]] = {
|
exact_queries_by_index: dict[str, list[Any]] = {
|
||||||
"categories": [
|
"categories": [
|
||||||
|
|
@ -299,7 +299,7 @@ def process_query(
|
||||||
hit_cache.append(h)
|
hit_cache.append(h)
|
||||||
seen_keys.add(k)
|
seen_keys.add(k)
|
||||||
if getattr(h, "uuid", None):
|
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 = {}
|
products_by_uuid = {}
|
||||||
brands_by_uuid = {}
|
brands_by_uuid = {}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue