From 3cc0e3ecb6f7ff6b4cd9ae9bf244fb237122fc99 Mon Sep 17 00:00:00 2001 From: Que Nguyen Date: Mon, 17 Jun 2024 14:36:26 +0700 Subject: [PATCH] Refactor rag/main.py Renamed function get_filtered_results --- backend/apps/rag/search/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/apps/rag/search/main.py b/backend/apps/rag/search/main.py index 612177581..4041372f3 100644 --- a/backend/apps/rag/search/main.py +++ b/backend/apps/rag/search/main.py @@ -3,13 +3,13 @@ from urllib.parse import urlparse from pydantic import BaseModel -def filter_by_whitelist(results, whitelist): - if not whitelist: +def get_filtered_results(results, filter_list): + if not filter_list: return results filtered_results = [] for result in results: domain = urlparse(result["url"]).netloc - if any(domain.endswith(whitelisted_domain) for whitelisted_domain in whitelist): + if any(domain.endswith(filtered_domain) for filtered_domain in filter_list): filtered_results.append(result) return filtered_results