commit a05134e9032fe3348411dfbf808084f8e227ab21
parent 010249e49b1b12c26084f72e5feb20eaab13fbf0
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 25 Apr 2016 00:48:38 -0400
Fix search by file type
Fixes #966
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js
@@ -1230,7 +1230,7 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () {
var patterns = yield Zotero.DB.columnQueryAsync(ftSQL, { int: condition.value });
if (patterns) {
for each(str in patterns) {
- condSQL += 'mimeType LIKE ? OR ';
+ condSQL += 'contentType LIKE ? OR ';
condSQLParams.push(str + '%');
}
condSQL = condSQL.substring(0, condSQL.length - 4);
diff --git a/test/tests/searchTest.js b/test/tests/searchTest.js
@@ -146,6 +146,13 @@ describe("Zotero.Search", function() {
let matches = yield s.search();
assert.deepEqual(matches, [foobarItem.id]);
});
+
+ it("should search by attachment file type", function* () {
+ let s = new Zotero.Search();
+ s.addCondition('fileTypeID', 'is', Zotero.FileTypes.getID('webpage'));
+ let matches = yield s.search();
+ assert.sameMembers(matches, [fooItem.id, foobarItem.id]);
+ });
});
describe("#toJSON()", function () {