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:
parent
2b00819253
commit
f6e7cf83fa
1 changed files with 18 additions and 0 deletions
|
@ -410,6 +410,11 @@ Zotero.Search.prototype.addCondition = function(condition, operator, value, requ
|
||||||
|
|
||||||
for each(var part in parts) {
|
for each(var part in parts) {
|
||||||
this.addCondition('blockStart');
|
this.addCondition('blockStart');
|
||||||
|
|
||||||
|
if (operator == 'contains' && part.text.length > 1) {
|
||||||
|
this.addCondition('key', 'beginsWith', part.text, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (condition == 'quicksearch-titleCreatorYear') {
|
if (condition == 'quicksearch-titleCreatorYear') {
|
||||||
this.addCondition('title', operator, part.text, false);
|
this.addCondition('title', operator, part.text, false);
|
||||||
this.addCondition('year', operator, part.text, false);
|
this.addCondition('year', operator, part.text, false);
|
||||||
|
@ -2180,6 +2185,19 @@ Zotero.SearchConditions = new function(){
|
||||||
noLoad: true
|
noLoad: true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
operators: {
|
||||||
|
is: true,
|
||||||
|
isNot: true,
|
||||||
|
beginsWith: true
|
||||||
|
},
|
||||||
|
table: 'items',
|
||||||
|
field: 'key',
|
||||||
|
special: true,
|
||||||
|
noLoad: true
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'annotation',
|
name: 'annotation',
|
||||||
operators: {
|
operators: {
|
||||||
|
|
Loading…
Reference in a new issue