Merge lp:~rainct/zeitgeist/least-popular-959615 into lp:~zeitgeist/zeitgeist/bluebird

Proposed by Siegfried Gevatter
Status: Superseded
Proposed branch: lp:~rainct/zeitgeist/least-popular-959615
Merge into: lp:~zeitgeist/zeitgeist/bluebird
Diff against target: 144 lines (+38/-12)
5 files modified
extensions/fts++/indexer.cpp (+8/-0)
extensions/fts++/test/test-indexer.cpp (+19/-0)
src/datamodel.vala (+7/-8)
src/db-reader.vala (+1/-1)
test/dbus/engine-test.py (+3/-3)
To merge this branch: bzr merge lp:~rainct/zeitgeist/least-popular-959615
Reviewer Review Type Date Requested Status
Zeitgeist Framework Team Pending
Review via email: mp+100013@code.launchpad.net

This proposal has been superseded by a proposal from 2012-04-10.

To post a comment you must log in.

Unmerged revisions

458. By Siegfried Gevatter

Fix sorting of LEAST_POPULAR_* result types (LP: #959615)

They should query for least popular X but return the most
(not least) recent event for it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
13031303
1304void Indexer::IndexEvent (ZeitgeistEvent *event)1304void Indexer::IndexEvent (ZeitgeistEvent *event)
1305{1305{
1306 // Blacklist Ubuntu One events...
1307 const gchar *actor;
1308 actor = zeitgeist_event_get_actor (event);
1309 if (strcmp(actor, "dbus://com.ubuntuone.SyncDaemon.service") == 0)
1310 return;
1311 if (strcmp(actor, "dbus://org.desktopcouch.CouchDB.service") == 0)
1312 return;
1313
1306 try1314 try
1307 {1315 {
1308 const gchar *val;1316 const gchar *val;
13091317
=== 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 @@
1074 assert_nth_result_has_id (results, 2, event_id6);1074 assert_nth_result_has_id (results, 2, event_id6);
1075}1075}
10761076
1077static void
1078test_index_ignore_ubuntu_one (Fixture *fix, gconstpointer data)
1079{
1080 guint matches;
1081
1082 // add test events to DBs
1083 index_event (fix, create_test_event_simple ("ubuntuone:uuid", "failme"));
1084 ZeitgeistEvent *event = create_test_event_simple ("file:///nice%20uri", "failme");
1085 zeitgeist_event_set_actor (event, "dbus://com.ubuntuone.SyncDaemon.service");
1086 index_event (fix, event);
1087
1088 GPtrArray *results = search_simple (fix, "failme", NULL,
1089 ZEITGEIST_RESULT_TYPE_MOST_RECENT_EVENTS, &matches);
1090
1091 g_assert_cmpuint (results->len, ==, 0);
1092}
1093
1077G_BEGIN_DECLS1094G_BEGIN_DECLS
10781095
1079static void discard_message (const gchar *domain,1096static void discard_message (const gchar *domain,
@@ -1138,6 +1155,8 @@
1138 g_test_add ("/Zeitgeist/FTS/Indexer/Query/MostPopularSubjects", Fixture, 0,1155 g_test_add ("/Zeitgeist/FTS/Indexer/Query/MostPopularSubjects", Fixture, 0,
1139 setup, test_query_most_popular_subjects, teardown);1156 setup, test_query_most_popular_subjects, teardown);
1140 */1157 */
1158 g_test_add ("/Zeitgeist/FTS/Indexer/Index/IgnoreUbuntuOne", Fixture, 0,
1159 setup, test_index_ignore_ubuntu_one, teardown);
11411160
1142 // get rid of the "rebuilding index..." messages1161 // get rid of the "rebuilding index..." messages
1143 g_log_set_handler (NULL, G_LOG_LEVEL_MESSAGE, discard_message, NULL);1162 g_log_set_handler (NULL, G_LOG_LEVEL_MESSAGE, discard_message, NULL);
11441163
=== 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 @@
243 {243 {
244 switch (result_type)244 switch (result_type)
245 {245 {
246 // FIXME: Why are LEAST_POPULAR_* using ASC?
247 case ResultType.LEAST_RECENT_EVENTS:246 case ResultType.LEAST_RECENT_EVENTS:
248 case ResultType.LEAST_RECENT_EVENT_ORIGIN:247 case ResultType.LEAST_RECENT_EVENT_ORIGIN:
249 case ResultType.LEAST_POPULAR_EVENT_ORIGIN:
250 case ResultType.LEAST_RECENT_SUBJECTS:248 case ResultType.LEAST_RECENT_SUBJECTS:
251 case ResultType.LEAST_POPULAR_SUBJECTS:
252 case ResultType.LEAST_RECENT_CURRENT_URI:249 case ResultType.LEAST_RECENT_CURRENT_URI:
253 case ResultType.LEAST_POPULAR_CURRENT_URI:
254 case ResultType.LEAST_RECENT_ACTOR:250 case ResultType.LEAST_RECENT_ACTOR:
255 case ResultType.LEAST_POPULAR_ACTOR:
256 case ResultType.OLDEST_ACTOR:251 case ResultType.OLDEST_ACTOR:
257 case ResultType.LEAST_RECENT_ORIGIN:252 case ResultType.LEAST_RECENT_ORIGIN:
258 case ResultType.LEAST_POPULAR_ORIGIN:
259 case ResultType.LEAST_RECENT_SUBJECT_INTERPRETATION:253 case ResultType.LEAST_RECENT_SUBJECT_INTERPRETATION:
260 case ResultType.LEAST_POPULAR_SUBJECT_INTERPRETATION:
261 case ResultType.LEAST_RECENT_MIMETYPE:254 case ResultType.LEAST_RECENT_MIMETYPE:
262 case ResultType.LEAST_POPULAR_MIMETYPE:
263 return true;255 return true;
264256
265 case ResultType.MOST_RECENT_EVENTS:257 case ResultType.MOST_RECENT_EVENTS:
266 case ResultType.MOST_RECENT_EVENT_ORIGIN:258 case ResultType.MOST_RECENT_EVENT_ORIGIN:
267 case ResultType.MOST_POPULAR_EVENT_ORIGIN:259 case ResultType.MOST_POPULAR_EVENT_ORIGIN:
260 case ResultType.LEAST_POPULAR_EVENT_ORIGIN:
268 case ResultType.MOST_RECENT_SUBJECTS:261 case ResultType.MOST_RECENT_SUBJECTS:
269 case ResultType.MOST_POPULAR_SUBJECTS:262 case ResultType.MOST_POPULAR_SUBJECTS:
263 case ResultType.LEAST_POPULAR_SUBJECTS:
270 case ResultType.MOST_RECENT_CURRENT_URI:264 case ResultType.MOST_RECENT_CURRENT_URI:
271 case ResultType.MOST_POPULAR_CURRENT_URI:265 case ResultType.MOST_POPULAR_CURRENT_URI:
266 case ResultType.LEAST_POPULAR_CURRENT_URI:
272 case ResultType.MOST_RECENT_ACTOR:267 case ResultType.MOST_RECENT_ACTOR:
273 case ResultType.MOST_POPULAR_ACTOR:268 case ResultType.MOST_POPULAR_ACTOR:
269 case ResultType.LEAST_POPULAR_ACTOR:
274 case ResultType.MOST_RECENT_ORIGIN:270 case ResultType.MOST_RECENT_ORIGIN:
275 case ResultType.MOST_POPULAR_ORIGIN:271 case ResultType.MOST_POPULAR_ORIGIN:
272 case ResultType.LEAST_POPULAR_ORIGIN:
276 case ResultType.MOST_RECENT_SUBJECT_INTERPRETATION:273 case ResultType.MOST_RECENT_SUBJECT_INTERPRETATION:
277 case ResultType.MOST_POPULAR_SUBJECT_INTERPRETATION:274 case ResultType.MOST_POPULAR_SUBJECT_INTERPRETATION:
275 case ResultType.LEAST_POPULAR_SUBJECT_INTERPRETATION:
278 case ResultType.MOST_RECENT_MIMETYPE:276 case ResultType.MOST_RECENT_MIMETYPE:
279 case ResultType.MOST_POPULAR_MIMETYPE:277 case ResultType.MOST_POPULAR_MIMETYPE:
278 case ResultType.LEAST_POPULAR_MIMETYPE:
280 return false;279 return false;
281280
282 default:281 default:
283282
=== 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 @@
270 warning (error_message);270 warning (error_message);
271 throw new EngineError.INVALID_ARGUMENT (error_message);271 throw new EngineError.INVALID_ARGUMENT (error_message);
272 }272 }
273 273
274 // complete the sort rule274 // complete the sort rule
275 bool time_asc = ResultType.is_sort_order_asc ((ResultType) result_type);275 bool time_asc = ResultType.is_sort_order_asc ((ResultType) result_type);
276 sql += " timestamp %s".printf ((time_asc) ? "ASC" : "DESC");276 sql += " timestamp %s".printf ((time_asc) ? "ASC" : "DESC");
277277
=== 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 @@
829 events = self.getEventsAndWait(ids)829 events = self.getEventsAndWait(ids)
830 830
831 self.assertEquals([e.timestamp for e in events],831 self.assertEquals([e.timestamp for e in events],
832 ["123", "153", "163", "143"])832 ["163", "153", "123", "143"])
833 833
834 def testResultTypesMostRecentCurrentUri(self):834 def testResultTypesMostRecentCurrentUri(self):
835 import_events("test/data/five_events.js", self)835 import_events("test/data/five_events.js", self)
@@ -988,8 +988,8 @@
988 events = self.getEventsAndWait(ids)988 events = self.getEventsAndWait(ids)
989 989
990 self.assertEquals([e[0][5] for e in events],990 self.assertEquals([e[0][5] for e in events],
991 ["origin2", "origin3", "origin1"])991 ["origin3", "origin2", "origin1"])
992 self.assertEquals([e.timestamp for e in events], ["100", "103", "102"])992 self.assertEquals([e.timestamp for e in events], ["103", "100", "102"])
993993
994 def testResultTypesMostRecentEventOrigin(self):994 def testResultTypesMostRecentEventOrigin(self):
995 import_events("test/data/twenty_events.js", self)995 import_events("test/data/twenty_events.js", self)

Subscribers

People subscribed via source and target branches