File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -91,16 +91,16 @@ def _extract_search_results(raw_results, max_items: int = 10):
91
91
search"""
92
92
search_results = []
93
93
94
+ LOGGER .debug (f"Extracting search results from { raw_results } " )
95
+
94
96
def find_articles (node ):
95
- LOGGER .debug (f"Searching for products in { node } " )
96
97
if len (search_results ) >= max_items :
97
98
return
98
99
99
100
content = node .get ("content" , {})
100
101
if content .get ("type" ) == "SELLING_UNIT_TILE" and "sellingUnit" in content :
101
102
selling_unit = content ["sellingUnit" ]
102
- sole_article_ids = SOLE_ARTICLE_ID_PATTERN .findall (
103
- json .dumps (node ))
103
+ sole_article_ids = SOLE_ARTICLE_ID_PATTERN .findall (json .dumps (node ))
104
104
sole_article_id = sole_article_ids [0 ] if sole_article_ids else None
105
105
result_entry = {
106
106
** selling_unit ,
@@ -115,11 +115,9 @@ def find_articles(node):
115
115
if "child" in node :
116
116
find_articles (node .get ("child" ))
117
117
118
- LOGGER .debug (f"Leaving extraction for node { node } " )
119
-
120
118
body = raw_results .get ("body" , {})
121
119
find_articles (body .get ("child" , {}))
122
120
123
- LOGGER .debug (f"Found { len (search_results )} products after extraction" )
121
+ LOGGER .debug (f"Found { len (search_results )} / { max_items } products after extraction" )
124
122
125
123
return [{"items" : search_results }]
You can’t perform that action at this time.
0 commit comments