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
=== modified file 'src/daemon.vala'
--- src/daemon.vala 2013-04-24 12:04:17 +0000
+++ src/daemon.vala 2013-04-30 18:49:26 +0000
@@ -1053,8 +1053,10 @@
1053 return;1053 return;
10541054
1055 bool has_search = !Utils.is_search_empty (search_string);1055 bool has_search = !Utils.is_search_empty (search_string);
1056 var pkg_search_string = XapianUtils.prepare_pkg_search_string (
1057 search_string, null);
10561058
1057 var results = scopesearcher.search (search_string, 0,1059 var results = scopesearcher.search (pkg_search_string, 0,
1058 Unity.Package.SearchType.PREFIX,1060 Unity.Package.SearchType.PREFIX,
1059 has_search ?1061 has_search ?
1060 Unity.Package.Sort.BY_RELEVANCY :1062 Unity.Package.Sort.BY_RELEVANCY :
@@ -1069,10 +1071,18 @@
1069 continue;1071 continue;
1070 installed_uris.add(dedup_key);1072 installed_uris.add(dedup_key);
10711073
1074 /* Don't include master scopes in the search results. This is
1075 * performed after deduping so the master scopes don't just
1076 * move to hte "available" category. */
1077 if (info.is_master_scope)
1078 continue;
1079
1072 var uri = @"scope://$(info.desktop_file)";1080 var uri = @"scope://$(info.desktop_file)";
1073 var name = info.application_name;1081 var name = info.application_name;
1074 var icon_hint = info.icon;1082 var icon_hint = info.icon;
1075 var comment = info.description;1083 var comment = info.description;
1084 var category = info.desktop_file in disabled_scope_ids ?
1085 Category.AVAILABLE : Category.INSTALLED;
10761086
1077 try1087 try
1078 {1088 {
@@ -1089,7 +1099,7 @@
10891099
1090 model.append (uri,1100 model.append (uri,
1091 icon_hint,1101 icon_hint,
1092 Category.INSTALLED,1102 category,
1093 ResultType.DEFAULT,1103 ResultType.DEFAULT,
1094 "application/x-unity-scope",1104 "application/x-unity-scope",
1095 name != "" ? name : uri,1105 name != "" ? name : uri,
10961106
=== modified file 'src/unity-package-search.cc'
--- src/unity-package-search.cc 2013-04-24 10:16:55 +0000
+++ src/unity-package-search.cc 2013-04-30 18:49:26 +0000
@@ -59,6 +59,10 @@
59#define XAPIAN_VALUE_EXENAME 29459#define XAPIAN_VALUE_EXENAME 294
60#define XAPIAN_VALUE_CURRENCY 20160#define XAPIAN_VALUE_CURRENCY 201
6161
62/* this isn't a Software Center slot, but we use it to mark master
63 * scopes in the scope index. */
64#define XAPIAN_VALUE_MASTERSCOPE 1000
65
62#include "unity-package-search.h"66#include "unity-package-search.h"
63#include "columbus.hh"67#include "columbus.hh"
6468
@@ -403,6 +407,8 @@
403 doc.add_value (XAPIAN_VALUE_ICON, info->icon);407 doc.add_value (XAPIAN_VALUE_ICON, info->icon);
404 if (info->id != NULL)408 if (info->id != NULL)
405 doc.add_value (XAPIAN_VALUE_DESKTOP_FILE, info->id);409 doc.add_value (XAPIAN_VALUE_DESKTOP_FILE, info->id);
410 if (info->is_master)
411 doc.add_value (XAPIAN_VALUE_MASTERSCOPE, "true");
406412
407 indexer->set_document (doc);413 indexer->set_document (doc);
408 if (info->name != NULL)414 if (info->name != NULL)
@@ -564,6 +570,9 @@
564 const string purchase_date = doc.get_value (XAPIAN_VALUE_PURCHASED_DATE);570 const string purchase_date = doc.get_value (XAPIAN_VALUE_PURCHASED_DATE);
565 pkginfo->needs_purchase = purchase_date.empty ();571 pkginfo->needs_purchase = purchase_date.empty ();
566572
573 string is_master = doc.get_value (XAPIAN_VALUE_MASTERSCOPE);
574 pkginfo->is_master_scope = (is_master == "true");
575
567 return pkginfo;576 return pkginfo;
568}577}
569578
570579
=== modified file 'src/unity-package-search.h'
--- src/unity-package-search.h 2013-04-24 09:59:36 +0000
+++ src/unity-package-search.h 2013-04-30 18:49:26 +0000
@@ -51,6 +51,7 @@
51 gchar *price;51 gchar *price;
52 gboolean needs_purchase;52 gboolean needs_purchase;
53 gint relevancy;53 gint relevancy;
54 gboolean is_master_scope;
54} UnityPackageInfo;55} UnityPackageInfo;
5556
56typedef gboolean (*AppFilterCallback)(UnityPackageInfo *, void *);57typedef gboolean (*AppFilterCallback)(UnityPackageInfo *, void *);
5758
=== modified file 'vapi/unity-package-search.vapi'
--- vapi/unity-package-search.vapi 2013-04-24 09:59:36 +0000
+++ vapi/unity-package-search.vapi 2013-04-30 18:49:26 +0000
@@ -57,6 +57,7 @@
57 public string price;57 public string price;
58 public bool needs_purchase;58 public bool needs_purchase;
59 public int relevancy;59 public int relevancy;
60 public bool is_master_scope;
60 }61 }
61 }62 }
62}63}

Subscribers

People subscribed via source and target branches

to all changes: