From 362e18c7471fc15cf6c7a1f0e10f2bb04f8e5367 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 19 Jan 2017 13:32:29 -0500 Subject: [PATCH] Fix attachment content search And always convert ids from GROUP_CONCAT() to integers in search code. --- chrome/content/zotero/xpcom/data/search.js | 17 ++++++-------- test/tests/searchTest.js | 27 ++++++++++++++++++---- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/search.js b/chrome/content/zotero/xpcom/data/search.js index 91a28cb48..5443f078c 100644 --- a/chrome/content/zotero/xpcom/data/search.js +++ b/chrome/content/zotero/xpcom/data/search.js @@ -603,7 +603,7 @@ Zotero.Search.prototype.search = Zotero.Promise.coroutine(function* (asTempTable sql += ")"; var res = yield Zotero.DB.valueQueryAsync(sql, this._sqlParams); - var ids = res ? res.split(",") : []; + var ids = res ? res.split(",").map(id => parseInt(id)) : []; /* // DEBUG: Should this be here? // @@ -653,7 +653,7 @@ Zotero.Search.prototype.search = Zotero.Promise.coroutine(function* (asTempTable var sql = "SELECT GROUP_CONCAT(itemID) FROM items WHERE " + "itemID NOT IN (SELECT itemID FROM " + tmpTable + ")"; var res = yield Zotero.DB.valueQueryAsync(sql); - var scopeIDs = res ? res.split(",") : []; + var scopeIDs = res ? res.split(",").map(id => parseInt(id)) : []; } // If an ALL search, scan only items from the main search else { @@ -701,7 +701,7 @@ Zotero.Search.prototype.search = Zotero.Promise.coroutine(function* (asTempTable if (joinMode == 'all' && !hasQuicksearch) { var hash = {}; for (let i=0; i parseInt(id)) : []; // Add parents and children to main ids - if (parentChildIDs) { - for (var i=0; i