zeitgeist team mailing list archive
-
zeitgeist team
-
Mailing list archive
-
Message #05342
[Merge] lp:~rainct/zeitgeist/least-popular-959615 into lp:zeitgeist
Siegfried Gevatter has proposed merging lp:~rainct/zeitgeist/least-popular-959615 into lp:zeitgeist.
Requested reviews:
Zeitgeist Framework Team (zeitgeist)
Related bugs:
Bug #959615 in Zeitgeist Framework: "Sorting of LEAST_POPULAR_* result type"
https://bugs.launchpad.net/zeitgeist/+bug/959615
For more details, see:
https://code.launchpad.net/~rainct/zeitgeist/least-popular-959615/+merge/100013
--
https://code.launchpad.net/~rainct/zeitgeist/least-popular-959615/+merge/100013
Your team Zeitgeist Framework Team is requested to review the proposed merge of lp:~rainct/zeitgeist/least-popular-959615 into lp:zeitgeist.
=== modified file 'extensions/fts++/indexer.cpp'
--- extensions/fts++/indexer.cpp 2012-03-26 16:43:07 +0000
+++ extensions/fts++/indexer.cpp 2012-03-29 19:39:19 +0000
@@ -1303,6 +1303,14 @@
void Indexer::IndexEvent (ZeitgeistEvent *event)
{
+ // Blacklist Ubuntu One events...
+ const gchar *actor;
+ actor = zeitgeist_event_get_actor (event);
+ if (strcmp(actor, "dbus://com.ubuntuone.SyncDaemon.service") == 0)
+ return;
+ if (strcmp(actor, "dbus://org.desktopcouch.CouchDB.service") == 0)
+ return;
+
try
{
const gchar *val;
=== modified file 'extensions/fts++/test/test-indexer.cpp'
--- extensions/fts++/test/test-indexer.cpp 2012-03-20 12:25:59 +0000
+++ extensions/fts++/test/test-indexer.cpp 2012-03-29 19:39:19 +0000
@@ -1074,6 +1074,23 @@
assert_nth_result_has_id (results, 2, event_id6);
}
+static void
+test_index_ignore_ubuntu_one (Fixture *fix, gconstpointer data)
+{
+ guint matches;
+
+ // add test events to DBs
+ index_event (fix, create_test_event_simple ("ubuntuone:uuid", "failme"));
+ ZeitgeistEvent *event = create_test_event_simple ("file:///nice%20uri", "failme");
+ zeitgeist_event_set_actor (event, "dbus://com.ubuntuone.SyncDaemon.service");
+ index_event (fix, event);
+
+ GPtrArray *results = search_simple (fix, "failme", NULL,
+ ZEITGEIST_RESULT_TYPE_MOST_RECENT_EVENTS, &matches);
+
+ g_assert_cmpuint (results->len, ==, 0);
+}
+
G_BEGIN_DECLS
static void discard_message (const gchar *domain,
@@ -1138,6 +1155,8 @@
g_test_add ("/Zeitgeist/FTS/Indexer/Query/MostPopularSubjects", Fixture, 0,
setup, test_query_most_popular_subjects, teardown);
*/
+ g_test_add ("/Zeitgeist/FTS/Indexer/Index/IgnoreUbuntuOne", Fixture, 0,
+ setup, test_index_ignore_ubuntu_one, teardown);
// get rid of the "rebuilding index..." messages
g_log_set_handler (NULL, G_LOG_LEVEL_MESSAGE, discard_message, NULL);
=== modified file 'src/datamodel.vala'
--- src/datamodel.vala 2012-03-27 14:30:23 +0000
+++ src/datamodel.vala 2012-03-29 19:39:19 +0000
@@ -243,40 +243,39 @@
{
switch (result_type)
{
- // FIXME: Why are LEAST_POPULAR_* using ASC?
case ResultType.LEAST_RECENT_EVENTS:
case ResultType.LEAST_RECENT_EVENT_ORIGIN:
- case ResultType.LEAST_POPULAR_EVENT_ORIGIN:
case ResultType.LEAST_RECENT_SUBJECTS:
- case ResultType.LEAST_POPULAR_SUBJECTS:
case ResultType.LEAST_RECENT_CURRENT_URI:
- case ResultType.LEAST_POPULAR_CURRENT_URI:
case ResultType.LEAST_RECENT_ACTOR:
- case ResultType.LEAST_POPULAR_ACTOR:
case ResultType.OLDEST_ACTOR:
case ResultType.LEAST_RECENT_ORIGIN:
- case ResultType.LEAST_POPULAR_ORIGIN:
case ResultType.LEAST_RECENT_SUBJECT_INTERPRETATION:
- case ResultType.LEAST_POPULAR_SUBJECT_INTERPRETATION:
case ResultType.LEAST_RECENT_MIMETYPE:
- case ResultType.LEAST_POPULAR_MIMETYPE:
return true;
case ResultType.MOST_RECENT_EVENTS:
case ResultType.MOST_RECENT_EVENT_ORIGIN:
case ResultType.MOST_POPULAR_EVENT_ORIGIN:
+ case ResultType.LEAST_POPULAR_EVENT_ORIGIN:
case ResultType.MOST_RECENT_SUBJECTS:
case ResultType.MOST_POPULAR_SUBJECTS:
+ case ResultType.LEAST_POPULAR_SUBJECTS:
case ResultType.MOST_RECENT_CURRENT_URI:
case ResultType.MOST_POPULAR_CURRENT_URI:
+ case ResultType.LEAST_POPULAR_CURRENT_URI:
case ResultType.MOST_RECENT_ACTOR:
case ResultType.MOST_POPULAR_ACTOR:
+ case ResultType.LEAST_POPULAR_ACTOR:
case ResultType.MOST_RECENT_ORIGIN:
case ResultType.MOST_POPULAR_ORIGIN:
+ case ResultType.LEAST_POPULAR_ORIGIN:
case ResultType.MOST_RECENT_SUBJECT_INTERPRETATION:
case ResultType.MOST_POPULAR_SUBJECT_INTERPRETATION:
+ case ResultType.LEAST_POPULAR_SUBJECT_INTERPRETATION:
case ResultType.MOST_RECENT_MIMETYPE:
case ResultType.MOST_POPULAR_MIMETYPE:
+ case ResultType.LEAST_POPULAR_MIMETYPE:
return false;
default:
=== modified file 'src/db-reader.vala'
--- src/db-reader.vala 2012-03-19 19:56:38 +0000
+++ src/db-reader.vala 2012-03-29 19:39:19 +0000
@@ -270,7 +270,7 @@
warning (error_message);
throw new EngineError.INVALID_ARGUMENT (error_message);
}
-
+
// complete the sort rule
bool time_asc = ResultType.is_sort_order_asc ((ResultType) result_type);
sql += " timestamp %s".printf ((time_asc) ? "ASC" : "DESC");
=== modified file 'test/dbus/engine-test.py'
--- test/dbus/engine-test.py 2012-03-16 17:08:43 +0000
+++ test/dbus/engine-test.py 2012-03-29 19:39:19 +0000
@@ -829,7 +829,7 @@
events = self.getEventsAndWait(ids)
self.assertEquals([e.timestamp for e in events],
- ["123", "153", "163", "143"])
+ ["163", "153", "123", "143"])
def testResultTypesMostRecentCurrentUri(self):
import_events("test/data/five_events.js", self)
@@ -988,8 +988,8 @@
events = self.getEventsAndWait(ids)
self.assertEquals([e[0][5] for e in events],
- ["origin2", "origin3", "origin1"])
- self.assertEquals([e.timestamp for e in events], ["100", "103", "102"])
+ ["origin3", "origin2", "origin1"])
+ self.assertEquals([e.timestamp for e in events], ["103", "100", "102"])
def testResultTypesMostRecentEventOrigin(self):
import_events("test/data/twenty_events.js", self)