commit f6e7cf83fac6273d96368045696cfcb0219430e3
parent 2b00819253f3c29ce5604d2aa0b767d0aaa35b19
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 8 Aug 2012 01:56:25 -0400
Add ability to search for item by key from quick search bar
Matches beginning of key only, and only when search string is >= 2 chars
Diffstat:
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js
@@ -410,6 +410,11 @@ Zotero.Search.prototype.addCondition = function(condition, operator, value, requ
for each(var part in parts) {
this.addCondition('blockStart');
+
+ if (operator == 'contains' && part.text.length > 1) {
+ this.addCondition('key', 'beginsWith', part.text, false);
+ }
+
if (condition == 'quicksearch-titleCreatorYear') {
this.addCondition('title', operator, part.text, false);
this.addCondition('year', operator, part.text, false);
@@ -2181,6 +2186,19 @@ Zotero.SearchConditions = new function(){
},
{
+ name: 'key',
+ operators: {
+ is: true,
+ isNot: true,
+ beginsWith: true
+ },
+ table: 'items',
+ field: 'key',
+ special: true,
+ noLoad: true
+ },
+
+ {
name: 'annotation',
operators: {
contains: true,