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

Proposed by Siegfried Gevatter on 2012-03-29
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 2012-03-29 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 on 2012-03-29

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
1=== modified file 'extensions/fts++/indexer.cpp'
2--- extensions/fts++/indexer.cpp 2012-03-26 16:43:07 +0000
3+++ extensions/fts++/indexer.cpp 2012-03-29 19:39:19 +0000
4@@ -1303,6 +1303,14 @@
5
6 void Indexer::IndexEvent (ZeitgeistEvent *event)
7 {
8+ // Blacklist Ubuntu One events...
9+ const gchar *actor;
10+ actor = zeitgeist_event_get_actor (event);
11+ if (strcmp(actor, "dbus://com.ubuntuone.SyncDaemon.service") == 0)
12+ return;
13+ if (strcmp(actor, "dbus://org.desktopcouch.CouchDB.service") == 0)
14+ return;
15+
16 try
17 {
18 const gchar *val;
19
20=== modified file 'extensions/fts++/test/test-indexer.cpp'
21--- extensions/fts++/test/test-indexer.cpp 2012-03-20 12:25:59 +0000
22+++ extensions/fts++/test/test-indexer.cpp 2012-03-29 19:39:19 +0000
23@@ -1074,6 +1074,23 @@
24 assert_nth_result_has_id (results, 2, event_id6);
25 }
26
27+static void
28+test_index_ignore_ubuntu_one (Fixture *fix, gconstpointer data)
29+{
30+ guint matches;
31+
32+ // add test events to DBs
33+ index_event (fix, create_test_event_simple ("ubuntuone:uuid", "failme"));
34+ ZeitgeistEvent *event = create_test_event_simple ("file:///nice%20uri", "failme");
35+ zeitgeist_event_set_actor (event, "dbus://com.ubuntuone.SyncDaemon.service");
36+ index_event (fix, event);
37+
38+ GPtrArray *results = search_simple (fix, "failme", NULL,
39+ ZEITGEIST_RESULT_TYPE_MOST_RECENT_EVENTS, &matches);
40+
41+ g_assert_cmpuint (results->len, ==, 0);
42+}
43+
44 G_BEGIN_DECLS
45
46 static void discard_message (const gchar *domain,
47@@ -1138,6 +1155,8 @@
48 g_test_add ("/Zeitgeist/FTS/Indexer/Query/MostPopularSubjects", Fixture, 0,
49 setup, test_query_most_popular_subjects, teardown);
50 */
51+ g_test_add ("/Zeitgeist/FTS/Indexer/Index/IgnoreUbuntuOne", Fixture, 0,
52+ setup, test_index_ignore_ubuntu_one, teardown);
53
54 // get rid of the "rebuilding index..." messages
55 g_log_set_handler (NULL, G_LOG_LEVEL_MESSAGE, discard_message, NULL);
56
57=== modified file 'src/datamodel.vala'
58--- src/datamodel.vala 2012-03-27 14:30:23 +0000
59+++ src/datamodel.vala 2012-03-29 19:39:19 +0000
60@@ -243,40 +243,39 @@
61 {
62 switch (result_type)
63 {
64- // FIXME: Why are LEAST_POPULAR_* using ASC?
65 case ResultType.LEAST_RECENT_EVENTS:
66 case ResultType.LEAST_RECENT_EVENT_ORIGIN:
67- case ResultType.LEAST_POPULAR_EVENT_ORIGIN:
68 case ResultType.LEAST_RECENT_SUBJECTS:
69- case ResultType.LEAST_POPULAR_SUBJECTS:
70 case ResultType.LEAST_RECENT_CURRENT_URI:
71- case ResultType.LEAST_POPULAR_CURRENT_URI:
72 case ResultType.LEAST_RECENT_ACTOR:
73- case ResultType.LEAST_POPULAR_ACTOR:
74 case ResultType.OLDEST_ACTOR:
75 case ResultType.LEAST_RECENT_ORIGIN:
76- case ResultType.LEAST_POPULAR_ORIGIN:
77 case ResultType.LEAST_RECENT_SUBJECT_INTERPRETATION:
78- case ResultType.LEAST_POPULAR_SUBJECT_INTERPRETATION:
79 case ResultType.LEAST_RECENT_MIMETYPE:
80- case ResultType.LEAST_POPULAR_MIMETYPE:
81 return true;
82
83 case ResultType.MOST_RECENT_EVENTS:
84 case ResultType.MOST_RECENT_EVENT_ORIGIN:
85 case ResultType.MOST_POPULAR_EVENT_ORIGIN:
86+ case ResultType.LEAST_POPULAR_EVENT_ORIGIN:
87 case ResultType.MOST_RECENT_SUBJECTS:
88 case ResultType.MOST_POPULAR_SUBJECTS:
89+ case ResultType.LEAST_POPULAR_SUBJECTS:
90 case ResultType.MOST_RECENT_CURRENT_URI:
91 case ResultType.MOST_POPULAR_CURRENT_URI:
92+ case ResultType.LEAST_POPULAR_CURRENT_URI:
93 case ResultType.MOST_RECENT_ACTOR:
94 case ResultType.MOST_POPULAR_ACTOR:
95+ case ResultType.LEAST_POPULAR_ACTOR:
96 case ResultType.MOST_RECENT_ORIGIN:
97 case ResultType.MOST_POPULAR_ORIGIN:
98+ case ResultType.LEAST_POPULAR_ORIGIN:
99 case ResultType.MOST_RECENT_SUBJECT_INTERPRETATION:
100 case ResultType.MOST_POPULAR_SUBJECT_INTERPRETATION:
101+ case ResultType.LEAST_POPULAR_SUBJECT_INTERPRETATION:
102 case ResultType.MOST_RECENT_MIMETYPE:
103 case ResultType.MOST_POPULAR_MIMETYPE:
104+ case ResultType.LEAST_POPULAR_MIMETYPE:
105 return false;
106
107 default:
108
109=== modified file 'src/db-reader.vala'
110--- src/db-reader.vala 2012-03-19 19:56:38 +0000
111+++ src/db-reader.vala 2012-03-29 19:39:19 +0000
112@@ -270,7 +270,7 @@
113 warning (error_message);
114 throw new EngineError.INVALID_ARGUMENT (error_message);
115 }
116-
117+
118 // complete the sort rule
119 bool time_asc = ResultType.is_sort_order_asc ((ResultType) result_type);
120 sql += " timestamp %s".printf ((time_asc) ? "ASC" : "DESC");
121
122=== modified file 'test/dbus/engine-test.py'
123--- test/dbus/engine-test.py 2012-03-16 17:08:43 +0000
124+++ test/dbus/engine-test.py 2012-03-29 19:39:19 +0000
125@@ -829,7 +829,7 @@
126 events = self.getEventsAndWait(ids)
127
128 self.assertEquals([e.timestamp for e in events],
129- ["123", "153", "163", "143"])
130+ ["163", "153", "123", "143"])
131
132 def testResultTypesMostRecentCurrentUri(self):
133 import_events("test/data/five_events.js", self)
134@@ -988,8 +988,8 @@
135 events = self.getEventsAndWait(ids)
136
137 self.assertEquals([e[0][5] for e in events],
138- ["origin2", "origin3", "origin1"])
139- self.assertEquals([e.timestamp for e in events], ["100", "103", "102"])
140+ ["origin3", "origin2", "origin1"])
141+ self.assertEquals([e.timestamp for e in events], ["103", "100", "102"])
142
143 def testResultTypesMostRecentEventOrigin(self):
144 import_events("test/data/twenty_events.js", self)

Subscribers

People subscribed via source and target branches