From d055170c13e49410987e44517a38586e3b2dc87c Mon Sep 17 00:00:00 2001 From: Matti Eiden Date: Mon, 14 Aug 2023 15:33:40 +0300 Subject: [PATCH] Disable harrastushaku fuzzy keyword search Full text search + trigram similarity can result in inappropriate keywords to be selected in events. --- events/importer/harrastushaku.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/events/importer/harrastushaku.py b/events/importer/harrastushaku.py index dfa6b0f8e..6c1dc3b1c 100644 --- a/events/importer/harrastushaku.py +++ b/events/importer/harrastushaku.py @@ -413,10 +413,7 @@ def handle_one_time_event(self, event_data): self.event_syncher.mark(event) def get_event_keywords(self, activity_data): - keywords = self.get_event_keywords_from_main_categories( - activity_data - ) | self.get_event_keywords_from_search_words(activity_data) - return keywords + return self.get_event_keywords_from_main_categories(activity_data) def get_event_keywords_from_main_categories(self, activity_data): main_category_ids = { @@ -431,20 +428,6 @@ def get_event_keywords_from_main_categories(self, activity_data): self.keywords.get(kw_id) for kw_id in keyword_ids if kw_id in self.keywords } - def get_event_keywords_from_search_words(self, activity_data): - keywords = set() - search_words = activity_data.get("searchwords", []) - - cleaned_search_words = [ - s.strip().lower() for s in search_words.split(",") if s.strip() - ] - for kw in cleaned_search_words: - matches = self.match_keyword(kw) - if matches: - keywords |= set(matches) - - return keywords - def get_event_languages(self, activity_data): language_text = activity_data.get("languages", "").lower() languages = {