--- a/client/cloda-completers.js
+++ b/client/cloda-completers.js
@@ -27,30 +27,29 @@ var ContactCompleter = {
}
};
var TagCompleter = {
type: "tag",
complete: function(aAutocomplete, aText) {
console.log("Tag completer firing on", aText);
Gloda.dbMessages.view("raindrop!tags!all/all", {
+ startkey: aText,
+ endkey: aText + "\u9999",
success: function(result) {
var nodes = [];
if (!result.rows) {
console.log("Tag completer can't see any tags; db is new?");
return;
}
var tagNames = result.rows[0].value;
console.log("Tag completer got tag names:", tagNames);
- var textLength = aText.length;
tagNames.forEach(function (tagName) {
- if (tagName.substring(0, textLength) == aText) {
- var node = $("<div/>")[0];
- ElementXBL.prototype.addBinding.call(node, "autocomplete.xml#tag-completion");
- node.setTagName(tagName);
- nodes.push(node);
- }
+ var node = $("<div/>")[0];
+ ElementXBL.prototype.addBinding.call(node, "autocomplete.xml#tag-completion");
+ node.setTagName(tagName);
+ nodes.push(node);
});
aAutocomplete.haveSomeResults(aText, nodes, TagCompleter, 100);
}
});
}
};
--- a/schema/tags/all/views/all/map.js
+++ b/schema/tags/all/views/all/map.js
@@ -1,8 +1,8 @@
function(doc) {
if (doc.type && doc.type=='anno/tags' && doc.tags) {
var id = doc._id;
var emit_id = id.substr(0, id.indexOf('!')) + '!message';
for (var i = 0; i < doc.tags.length; i++)
- emit([doc.tags[i], doc.raindrop_seq], emit_id);
+ emit(doc.tags[i], null);
}
}
--- a/schema/tags/all/views/all/reduce.js
+++ b/schema/tags/all/views/all/reduce.js
@@ -1,13 +1,13 @@
function(keys, values, rereduce) {
var keySet = {}, i, j;
if (!rereduce) {
for (i = 0; i < keys.length; i++)
- keySet[keys[i][0][0]] = true;
+ keySet[keys[i][0]] = true;
}
else {
for (i = 0; i < values.length; i++) {
var inSet = values[i];
for (j = 0; j < inSet.length; j++)
keySet[inSet[j]] = true;
}
}