From 0a91618f46cfcc78f7f5bd8a065242ff6bee52a7 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Fri, 2 Mar 2012 08:36:50 +0100 Subject: [PATCH] [rigo] search bar: also search through descriptions --- rigo/rigo_app.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/rigo/rigo_app.py b/rigo/rigo_app.py index fdb17c506..95e8c30f7 100644 --- a/rigo/rigo_app.py +++ b/rigo/rigo_app.py @@ -125,14 +125,27 @@ class ApplicationsViewController(GObject.Object): return txt.replace(" ", "-").lower() matches = [] + + # exact match pkg_matches, rc = self._entropy.atom_match( text, multi_match = True, multi_repo = True, mask_filter = False) matches.extend(pkg_matches) + + # atom searching (name and desc) search_matches = self._entropy.atom_search( - _prepare_for_search(text), - repositories = self._entropy.repositories()) + text, + repositories = self._entropy.repositories(), + description = True) + matches.extend([x for x in search_matches if x not in matches]) + + if not search_matches: + search_matches = self._entropy.atom_search( + _prepare_for_search(text), + repositories = self._entropy.repositories()) + matches.extend([x for x in search_matches if x not in matches]) + # we have to decide if to show the treeview in # the UI thread, to avoid races (and also because we # have to...)