mirror of
https://github.com/thekiwismarthome/shopping-list-manager.git
synced 2026-08-30 11:34:41 +00:00
Compare commits
1 Commits
c55e90d74f
...
v2.6.2.01
| Author | SHA1 | Date | |
|---|---|---|---|
| 91cbc6018c |
@@ -519,11 +519,7 @@ class ShoppingListStorage:
|
|||||||
_LOGGER.warning("Search engine not initialized")
|
_LOGGER.warning("Search engine not initialized")
|
||||||
return []
|
return []
|
||||||
|
|
||||||
# Convert products dict to format search engine expects
|
results = self._search_engine.search(
|
||||||
products_dict = {pid: p.to_dict() for pid, p in self._products.items()}
|
|
||||||
search_engine = ProductSearch(products_dict)
|
|
||||||
|
|
||||||
results = search_engine.search(
|
|
||||||
query=query,
|
query=query,
|
||||||
limit=limit,
|
limit=limit,
|
||||||
exclude_allergens=exclude_allergens,
|
exclude_allergens=exclude_allergens,
|
||||||
@@ -531,7 +527,6 @@ class ShoppingListStorage:
|
|||||||
substitution_group=substitution_group,
|
substitution_group=substitution_group,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Convert back to Product objects
|
|
||||||
return [self._products[r["id"]] for r in results if r["id"] in self._products]
|
return [self._products[r["id"]] for r in results if r["id"] in self._products]
|
||||||
|
|
||||||
def find_product_substitutes(self, product_id: str, limit: int = 5) -> List[Product]:
|
def find_product_substitutes(self, product_id: str, limit: int = 5) -> List[Product]:
|
||||||
@@ -547,10 +542,7 @@ class ShoppingListStorage:
|
|||||||
if not self._search_engine:
|
if not self._search_engine:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
products_dict = {pid: p.to_dict() for pid, p in self._products.items()}
|
results = self._search_engine.find_substitutes(product_id, limit)
|
||||||
search_engine = ProductSearch(products_dict)
|
|
||||||
|
|
||||||
results = search_engine.find_substitutes(product_id, limit)
|
|
||||||
return [self._products[r["id"]] for r in results if r["id"] in self._products]
|
return [self._products[r["id"]] for r in results if r["id"] in self._products]
|
||||||
|
|
||||||
def get_product_suggestions(self, limit: int = 20) -> List[Product]:
|
def get_product_suggestions(self, limit: int = 20) -> List[Product]:
|
||||||
|
|||||||
Reference in New Issue
Block a user