lp:~unity-team/unity-lens-applications/no-inc-search

Created by Mikkel Kamstrup Erlandsen on 2010-09-20 and last modified on 2010-09-20
Get this branch:
bzr branch lp:~unity-team/unity-lens-applications/no-inc-search
Members of Unity Team can upload to this branch. Log in for directions.

Branch merges

Related bugs

Related blueprints

Branch information

Owner:
Unity Team
Project:
unity-lens-applications
Status:
Development

Recent revisions

100. By Mikkel Kamstrup Erlandsen on 2010-09-20

Experimental - Don't merge to trunk:

 * Disable incremental narrowing down of result set

99. By Mikkel Kamstrup Erlandsen on 2010-09-14

Post release version bump

98. By Mikkel Kamstrup Erlandsen on 2010-09-14

Release 0.2.20

97. By Mikkel Kamstrup Erlandsen on 2010-09-14

Merge Mikkel's branch lp:~unity-team/unity-place-applications/global-search-fixes:

 * Improves reliability of results in the global search mode

 * Allows for searching apps by executable names. Not doing this resulted in lots of confused users that couldn't find Totem by typing "totem" because we only indexed it as "Movie Player"

 * Some fixes in the de-duplication algorithm that could cause installed apps to only show up the Available group when they should be in the Installedd group

96. By Mikkel Kamstrup Erlandsen on 2010-09-13

Rebuild the application menu index on changes to the menu structure. Without this bugfix newly installed apps form Software Center will either not show up at all or show up in the Available section

95. By Mikkel Kamstrup Erlandsen on 2010-09-13

Too aggresive de-duplication of results could cause unique apps to be pruned from the results. This was especially visible when typing slowly.

Note: There still is another bug in the Unity rendering that causes some apps which are in the DeeModel to not be rendered. This is bug #609994: "Optimize texture memory usage for unexposed view icons"

--------- This line and the following will be ignored --------------

modified:
  src/daemon.vala
  src/utils.vala
unknown:
  applications.place
  log1.bustle
  unity-place-applications-0.2.15.tar.gz
  data/X-Unity-All-Applications.directory
  data/X-Unity-Media.directory
  data/unity-place-applications.menu
  po/da.gmo
  src/config.c
  src/config.vala
  src/daemon.c
  src/schemas.c
  src/unity-applications-daemon
  src/unity_applications_daemon.vala.stamp

=== modified file 'src/daemon.vala'
--- a/src/daemon.vala 2010-09-09 07:49:02 +0000
+++ b/src/daemon.vala 2010-09-13 12:58:15 +0000
@@ -422,7 +422,8 @@
           }
         else
           {
- debug ("Doing filter search: '%s'", search.get_search_string ());
+ debug ("Doing filter search on Most Used apps: '%s'",
+ search.get_search_string ());
             uint group = Group.MOST_USED;
             Dee.ResultSet filter_set = results_by_group.lookup (@"$group",
                                                                 TermMatchFlag.EXACT);
@@ -435,8 +436,7 @@
                   app_uris.add (ev.get_subject (0).get_uri ());
               }

- Unity.ApplicationsPlace.apply_uri_filter(app_uris,
- filter_set);
+ Utils.apply_uri_filter(app_uris, filter_set);
           }

         debug ("Found %u/%u Most Used apps for query '%s'",
@@ -559,7 +559,8 @@
       Set<string> available_uris = new HashSet<string> ();

       add_pkg_search_result (appresults, installed_uris, available_uris,
- model, results_by_group, is_filter_search);
+ model, Group.INSTALLED, results_by_group,
+ is_filter_search);

       timer.stop ();
       debug ("Listed %i Installed apps in %fms for query: %s",
@@ -571,10 +572,11 @@
           timer.start ();
           var pkgresults = pkgsearcher.search (search_string);
           add_pkg_search_result (pkgresults, installed_uris, available_uris,
- model, results_by_group, is_filter_search);
+ model, Group.AVAILABLE, results_by_group,
+ is_filter_search);
           timer.stop ();
           debug ("Listed %i Available apps in %fms for query: %s",
- appresults.num_hits, timer.elapsed ()*1000, search_string);
+ pkgresults.num_hits, timer.elapsed ()*1000, search_string);
         }

       return false;
@@ -584,6 +586,7 @@
                                         Set<string> installed_uris,
                                         Set<string> available_uris,
                                         Dee.Model model,
+ Group group,
                                         Dee.Index results_by_group,
                                         bool is_filter_search)
     {
@@ -593,27 +596,42 @@
       {
        if (pkginfo.desktop_file == null)
           continue;
-
- string uri;
+
         string desktop_id = Path.get_basename (pkginfo.desktop_file);
         AppInfo? app = appmanager.lookup (desktop_id);
- bool installed = app != null;

         if (app != null && !app.should_show ())
           continue;

- if (installed)
- uri = @"application://$(desktop_id)";
- else
+ /* De-dupe by 'application://foo.desktop' URI */
+ string uri = @"application://$(desktop_id)";
+ if (uri in installed_uris)
+ continue;
+
+ /* Apps that are not installed, ie. in the Available group
+ * use the 'unity-install://pkgname/Full App Name' URI scheme,
+ * but only use that after we've de-duped the results */
+ if (group == Group.AVAILABLE)
           uri = @"unity-install://$(pkginfo.package_name)/$(pkginfo.application_name)";

- if (uri in installed_uris || uri in available_uris)
- continue;
-
- if (installed)
- installed_uris.add (uri);
- else
- available_uris.add (uri);
+ string display_name;
+ string comment;
+ switch (group)
+ {
+ case Group.INSTALLED:
+ installed_uris.add (uri);
+ display_name = app.get_display_name ();
+ comment = app.get_description ();
+ break;
+ case Group.AVAILABLE:
+ available_uris.add (uri);
+ display_name = pkginfo.application_name;
+ comment = "";
+ break;
+ default:
+ warning (@"Illegal group for package search $(group)");
+ continue;
+ }

         Icon icon = find_pkg_icon (pkginfo);

@@ -621,10 +639,10 @@
           {
             model.append (ResultsColumn.URI, uri,
                           ResultsColumn.ICON_HINT, icon.to_string (),
- ResultsColumn.GROUP_ID, installed ? Group.INSTALLED : Group.AVAILABLE,
+ ResultsColumn.GROUP_ID, group,
                           ResultsColumn.MIMETYPE, "application/x-desktop",
- ResultsColumn.DISPLAY_NAME, installed ? app.get_display_name () : pkginfo.application_name,
- ResultsColumn.COMMENT, app != null ? app.get_description () : "",
+ ResultsColumn.DISPLAY_NAME, display_name,
+ ResultsColumn.COMMENT, comment,
                           -1);
           }
       }
@@ -632,18 +650,20 @@
       if (is_filter_search)
         {
           /* Filter the Installed group */
- uint group = Group.INSTALLED;
- var installed_set = results_by_group.lookup (@"$group",
- TermMatchFlag.EXACT);
- Unity.ApplicationsPlace.apply_uri_filter (installed_uris,
- installed_set);
-
- /* Filter the Available group */
- group = Group.AVAILABLE;
- var available_set = results_by_group.lookup (@"$group",
- TermMatchFlag.EXACT);
- Unity.ApplicationsPlace.apply_uri_filter (available_uris,
- available_set);
+ var filter_set = results_by_group.lookup (@"$((uint)group)",
+ TermMatchFlag.EXACT);
+ switch (group)
+ {
+ case Group.INSTALLED:
+ Utils.apply_uri_filter (installed_uris, filter_set);
+ break;
+ case Group.AVAILABLE:
+ Utils.apply_uri_filter (available_uris, filter_set);
+ break;
+ default:
+ warning (@"Illegal group for package search $(group)");
+ break;
+ }
         }
     }

@@ -824,28 +844,6 @@

   } /* END: class Daemon */

- /* Run through @filter_set and remove any row in which URI is not
- * in @valid_uris */
- public void apply_uri_filter (Set<string> valid_uris,
- Dee.ResultSet filter_set)
- {
- var model = filter_set.get_model ();
- uint n_removed = 0;
-
- /* Anything in filter_set that is not in the event_uris set, is removed
- * from the results_model */
- foreach (var row in filter_set)
- {
- if (!(model.get_string (row, ResultsColumn.URI) in valid_uris))
- {
- model.remove (row);
- n_removed++;
- }
- }
-
- debug ("Removed %u rows from result set", n_removed);
- }
-
   /*public void append_treedir_with_group (GMenu.TreeDirectory treedir,
                                         Dee.Model results,
                                         uint group_id)

=== modified file 'src/utils.vala'
--- a/src/utils.vala 2010-09-06 13:22:00 +0000
+++ b/src/utils.vala 2010-09-13 12:58:29 +0000
@@ -118,7 +118,28 @@
         else
           return s1.strip () != s2.strip ();
       }
-
- return true;
+ }
+
+ /* Run through @filter_set and remove any row in which URI is not
+ * in @valid_uris */
+ public void apply_uri_filter (Set<string> valid_uris,
+ Dee.ResultSet filter_set)
+ {
+ var model = filter_set.get_model ();
+ uint n_removed = 0;
+
+ /* Anything in filter_set that is not in the event_uris set, is removed
+ * from the results_model */
+ foreach (var row in filter_set)
+ {
+ if (!(model.get_string (row, ResultsColumn.URI) in valid_uris))
+ {
+ //debug ("Removed: %s", model.get_string (row, ResultsColumn.URI));
+ model.remove (row);
+ n_removed++;
+ }
+ }
+
+ debug ("Removed %u rows from result set", n_removed);
   }
 }

94. By Mikkel Kamstrup Erlandsen on 2010-09-09

Post release version bump

93. By Mikkel Kamstrup Erlandsen on 2010-09-09

Release 0.2.18

92. By Mikkel Kamstrup Erlandsen on 2010-09-09

Add icon hints for group headers

91. By Mikkel Kamstrup Erlandsen on 2010-09-07

Merge Mikkel's branch lp:~unity-team/unity-place-applications/i18nfixes:

 * Fix an untranslatable string. Or to be precise - it was marked for translation, but was a Vala @-string which doesn't work with i18n generally.

 * Fix a TRANSLATORS comment

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
Stacked on:
lp:unity-lens-applications
This branch contains Public information 
Everyone can see this information.

Subscribers