Add search field to inbox

Using the search field produces a filtered view of all contacts and
groups containing the input. To make this fast and scalable, add an
index on a 'tokens' array containing words from the conversation name
and different forms of phone number.

Closes #365

// FREEBIE
This commit is contained in:
lilia 2015-10-15 12:10:03 -07:00
parent 7414828bb3
commit f70c22f898
8 changed files with 221 additions and 9 deletions

View file

@ -34,6 +34,21 @@
var items = transaction.db.createObjectStore("items");
next();
}
},
{
version: "2.0",
migrate: function(transaction, next) {
var conversations = transaction.objectStore("conversations");
conversations.createIndex("search", "tokens", { unique: false, multiEntry: true });
var all = new Whisper.ConversationCollection();
all.fetch().then(function() {
all.each(function(model) {
model.updateTokens();
model.save();
});
});
}
}
];
}());