Merge lp:~jamesh/unity-lens-applications/scope-search-fixes into lp:~unity-team/unity-lens-applications/libunity7-compatible

Proposed by James Henstridge
Status: Merged
Approved by: Michal Hruby
Approved revision: 346
Merged at revision: 343
Proposed branch: lp:~jamesh/unity-lens-applications/scope-search-fixes
Merge into: lp:~unity-team/unity-lens-applications/libunity7-compatible
Diff against target: 101 lines (+23/-2)
4 files modified
src/daemon.vala (+12/-2)
src/unity-package-search.cc (+9/-0)
src/unity-package-search.h (+1/-0)
vapi/unity-package-search.vapi (+1/-0)
To merge this branch: bzr merge lp:~jamesh/unity-lens-applications/scope-search-fixes
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+161517@code.launchpad.net

Commit message

Various scope search result fixes: show local scopes on empty search, filter out master scopes from results and move disabled local scopes to available category.

Description of the change

Some followup fixes to my index-local-scopes branch:

 1. Display some local scope results for empty searches (it was performing an empty query in this case, which gave no results).

 2. Filter out master scopes from the results (bug #1174464)

 3. Place disabled local scopes in the "available" category rather than "installed".

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michal Hruby (mhr3) wrote :

8 + // We get no results for an empty search, so use a search that
9 + // should match everything.
10 + if (!has_search) {
11 + search_string = "type:Scope";
12 + }

Could you move these conditions into the xapian-utils.vala source?

Otherwise looking good.

review: Needs Fixing
346. By James Henstridge

When searching local scopes, pass the query string through the
XapianUtils helpers.

Revision history for this message
James Henstridge (jamesh) wrote :

Done.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michal Hruby (mhr3) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/daemon.vala'
2--- src/daemon.vala 2013-04-24 12:04:17 +0000
3+++ src/daemon.vala 2013-04-30 18:49:26 +0000
4@@ -1053,8 +1053,10 @@
5 return;
6
7 bool has_search = !Utils.is_search_empty (search_string);
8+ var pkg_search_string = XapianUtils.prepare_pkg_search_string (
9+ search_string, null);
10
11- var results = scopesearcher.search (search_string, 0,
12+ var results = scopesearcher.search (pkg_search_string, 0,
13 Unity.Package.SearchType.PREFIX,
14 has_search ?
15 Unity.Package.Sort.BY_RELEVANCY :
16@@ -1069,10 +1071,18 @@
17 continue;
18 installed_uris.add(dedup_key);
19
20+ /* Don't include master scopes in the search results. This is
21+ * performed after deduping so the master scopes don't just
22+ * move to hte "available" category. */
23+ if (info.is_master_scope)
24+ continue;
25+
26 var uri = @"scope://$(info.desktop_file)";
27 var name = info.application_name;
28 var icon_hint = info.icon;
29 var comment = info.description;
30+ var category = info.desktop_file in disabled_scope_ids ?
31+ Category.AVAILABLE : Category.INSTALLED;
32
33 try
34 {
35@@ -1089,7 +1099,7 @@
36
37 model.append (uri,
38 icon_hint,
39- Category.INSTALLED,
40+ category,
41 ResultType.DEFAULT,
42 "application/x-unity-scope",
43 name != "" ? name : uri,
44
45=== modified file 'src/unity-package-search.cc'
46--- src/unity-package-search.cc 2013-04-24 10:16:55 +0000
47+++ src/unity-package-search.cc 2013-04-30 18:49:26 +0000
48@@ -59,6 +59,10 @@
49 #define XAPIAN_VALUE_EXENAME 294
50 #define XAPIAN_VALUE_CURRENCY 201
51
52+/* this isn't a Software Center slot, but we use it to mark master
53+ * scopes in the scope index. */
54+#define XAPIAN_VALUE_MASTERSCOPE 1000
55+
56 #include "unity-package-search.h"
57 #include "columbus.hh"
58
59@@ -403,6 +407,8 @@
60 doc.add_value (XAPIAN_VALUE_ICON, info->icon);
61 if (info->id != NULL)
62 doc.add_value (XAPIAN_VALUE_DESKTOP_FILE, info->id);
63+ if (info->is_master)
64+ doc.add_value (XAPIAN_VALUE_MASTERSCOPE, "true");
65
66 indexer->set_document (doc);
67 if (info->name != NULL)
68@@ -564,6 +570,9 @@
69 const string purchase_date = doc.get_value (XAPIAN_VALUE_PURCHASED_DATE);
70 pkginfo->needs_purchase = purchase_date.empty ();
71
72+ string is_master = doc.get_value (XAPIAN_VALUE_MASTERSCOPE);
73+ pkginfo->is_master_scope = (is_master == "true");
74+
75 return pkginfo;
76 }
77
78
79=== modified file 'src/unity-package-search.h'
80--- src/unity-package-search.h 2013-04-24 09:59:36 +0000
81+++ src/unity-package-search.h 2013-04-30 18:49:26 +0000
82@@ -51,6 +51,7 @@
83 gchar *price;
84 gboolean needs_purchase;
85 gint relevancy;
86+ gboolean is_master_scope;
87 } UnityPackageInfo;
88
89 typedef gboolean (*AppFilterCallback)(UnityPackageInfo *, void *);
90
91=== modified file 'vapi/unity-package-search.vapi'
92--- vapi/unity-package-search.vapi 2013-04-24 09:59:36 +0000
93+++ vapi/unity-package-search.vapi 2013-04-30 18:49:26 +0000
94@@ -57,6 +57,7 @@
95 public string price;
96 public bool needs_purchase;
97 public int relevancy;
98+ public bool is_master_scope;
99 }
100 }
101 }

Subscribers

People subscribed via source and target branches

to all changes: