From 2c4e43b2e8d81da79d6bd55f3d9e76a5c4eb75d2 Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Thu, 10 Aug 2017 13:23:59 +0300 Subject: [PATCH] Fixed IMAP search for text indexes --- lib/handlers/on-search.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/handlers/on-search.js b/lib/handlers/on-search.js index f4d71a26..80817732 100644 --- a/lib/handlers/on-search.js +++ b/lib/handlers/on-search.js @@ -62,8 +62,10 @@ module.exports = server => (path, options, session, callback) => { // fulltext can only be in the root of the query, not in $not, $or expressions // https://docs.mongodb.com/v3.4/tutorial/text-search-in-aggregation/#restrictions query.user = session.user.id; + query.searchable = true; query.$text = { - $search: term.value + $search: term.value, + $language: 'none' }; } else { // can not search by text @@ -367,10 +369,10 @@ module.exports = server => (path, options, session, callback) => { } uidList.push(message.uid); - processNext(); + setImmediate(processNext); }); }; - processNext(); + setImmediate(processNext); }); };