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
This commit is contained in:
Dan Stillman 2012-08-08 01:56:25 -04:00
parent 2b00819253
commit f6e7cf83fa

View file

@ -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);
@ -2180,6 +2185,19 @@ Zotero.SearchConditions = new function(){
noLoad: true
},
{
name: 'key',
operators: {
is: true,
isNot: true,
beginsWith: true
},
table: 'items',
field: 'key',
special: true,
noLoad: true
},
{
name: 'annotation',
operators: {