From a601cca79b61b8f619fc0cc548e054556800d48f Mon Sep 17 00:00:00 2001 From: Debanjum Date: Wed, 9 Jul 2025 00:21:44 -0700 Subject: [PATCH] Handle cases where no organic online search results found Previous organic results enumerator only handled the scenario where organic key wasn't present in online search results. It did not handle the case where there were no organic online search results. --- src/khoj/processor/tools/online_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/khoj/processor/tools/online_search.py b/src/khoj/processor/tools/online_search.py index 5261af51..0c89c5ce 100644 --- a/src/khoj/processor/tools/online_search.py +++ b/src/khoj/processor/tools/online_search.py @@ -148,7 +148,7 @@ async def search_online( for subquery in response_dict: if "answerBox" in response_dict[subquery]: continue - for idx, organic in enumerate(response_dict[subquery].get("organic", [])): + for idx, organic in enumerate(response_dict[subquery].get("organic") or []): link = organic.get("link") if link in webpages and idx < max_webpages_to_read: webpages[link]["queries"].add(subquery)