diff --git a/qtribu/gui/dlg_contents.py b/qtribu/gui/dlg_contents.py index bb1bb83e..9b2a924a 100644 --- a/qtribu/gui/dlg_contents.py +++ b/qtribu/gui/dlg_contents.py @@ -105,8 +105,9 @@ def refresh_list(self, expand_all: bool = False) -> None: def on_search_text_changed(self) -> None: # do nothing if text is too small current = self.search_line_edit.text() - if current != "": + if current == "": self.refresh_list(expand_all=True) + return if len(current) < 3: return self.refresh_list() diff --git a/qtribu/logic/json_feed.py b/qtribu/logic/json_feed.py index fe7e3fc8..338b0038 100644 --- a/qtribu/logic/json_feed.py +++ b/qtribu/logic/json_feed.py @@ -57,6 +57,9 @@ def _map_item(item: Dict[str, Any]) -> RssItem: @staticmethod def _matches(query: str, item: RssItem) -> bool: """Moteur de recherche du turfu""" + words = query.split(" ") + if len(words) > 1: + return all([JsonFeedClient._matches(w, item) for w in words]) return ( query.upper() in item.abstract.upper() or query.upper() in ",".join(item.author).upper()