Merge lp:~zhangew401/scope-aggregator/fix-empty-query-to-clickstore into lp:scope-aggregator

Proposed by Zhang Enwei
Status: Merged
Approved by: Zhang Enwei
Approved revision: 171
Merged at revision: 171
Proposed branch: lp:~zhangew401/scope-aggregator/fix-empty-query-to-clickstore
Merge into: lp:scope-aggregator
Diff against target: 90 lines (+23/-36)
2 files modified
src/query.cpp (+17/-14)
src/utils.cpp (+6/-22)
To merge this branch: bzr merge lp:~zhangew401/scope-aggregator/fix-empty-query-to-clickstore
Reviewer Review Type Date Requested Status
Kyle Nitzsche (community) Approve
Gary.Wang Pending
Review via email: mp+301982@code.launchpad.net

Description of the change

In r170, when query_store_ is empty, some random scopes will be recommended, we need to fix this.
Also fix comments from Gary.

To post a comment you must log in.
Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

Looks good to me.

Cheers

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/query.cpp'
2--- src/query.cpp 2016-07-12 17:14:05 +0000
3+++ src/query.cpp 2016-08-04 05:05:15 +0000
4@@ -1330,23 +1330,26 @@
5 qDebug() << "==== QUERY STRING: " << QString::fromStdString(query_string);
6 if (locID == "com.canonical.scopes.clickstore")
7 {
8- for (auto ch : current_child_scopes)
9+ if (query_store_ != "")
10 {
11- if (ch.id == localId_id_m[locID])
12+ for (auto ch : current_child_scopes)
13 {
14- qDebug() << "=== subsearch CLICKSTORE scope, locald_ID: " << qstr(locID) << " for: " << QString::fromStdString(query_store_);
15- subsearch
16- (
17- ch,
18- query_store_,
19- "",
20- us::FilterState(),
21- metadata,
22- replies[i]
23- );
24- break;
25+ if (ch.id == localId_id_m[locID])
26+ {
27+ qDebug() << "=== subsearch CLICKSTORE scope, locald_ID: " << qstr(locID) << " for: " << QString::fromStdString(query_store_);
28+ subsearch
29+ (
30+ ch,
31+ query_store_,
32+ "",
33+ us::FilterState(),
34+ metadata,
35+ replies[i]
36+ );
37+ break;
38+ }
39+
40 }
41-
42 }
43 }
44 else if (scope->keyword_scope())
45
46=== modified file 'src/utils.cpp'
47--- src/utils.cpp 2016-08-04 01:11:41 +0000
48+++ src/utils.cpp 2016-08-04 05:05:15 +0000
49@@ -1149,17 +1149,9 @@
50 scope->set_proxy(registry_);
51
52 if (!scope->exists()) {
53- auto myID = QString::fromStdString(id);
54- myID = myID.left(myID.indexOf("_"));
55- if (query_store_ == "")
56- {
57- query_store_.append("name:");
58- }
59- else
60- {
61- query_store_.append("+");
62- }
63- query_store_.append(myID.toStdString());
64+ std::string sep = query_store_ == "" ? "name:" : "+";
65+ std::string name = std::string(id, 0, id.find('_'));
66+ query_store_.append(sep + name);
67 }
68 else
69 {
70@@ -1172,17 +1164,9 @@
71 AggChildScope scope(source);
72 scope.set_proxy(registry_);
73 if (!scope.exists()) {
74- auto myID = QString::fromStdString(source);
75- myID = myID.left(myID.indexOf("_"));
76- if (query_store_ == "")
77- {
78- query_store_.append("name:");
79- }
80- else
81- {
82- query_store_.append("+");
83- }
84- query_store_.append(myID.toStdString());
85+ std::string sep = query_store_ == "" ? "name:" : "+";
86+ std::string name = std::string(source, 0, source.find('_'));
87+ query_store_.append(sep + name);
88 }
89 }
90 }

Subscribers

People subscribed via source and target branches

to all changes: