Search by specific creator type (#2353)
Author, editor, or book author.
This commit is contained in:
parent
924d29ff7e
commit
91cdc5610b
2 changed files with 48 additions and 0 deletions
|
@ -1331,6 +1331,15 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () {
|
|||
condSQL += "creatorID IN (SELECT creatorID FROM creators WHERE ";
|
||||
openParens++;
|
||||
break;
|
||||
|
||||
case 'author':
|
||||
case 'editor':
|
||||
case 'bookAuthor': {
|
||||
let creatorTypeID = Zotero.CreatorTypes.getID(condition.name);
|
||||
condSQL += `creatorTypeID = ${creatorTypeID} AND creatorID IN (SELECT creatorID FROM creators WHERE `;
|
||||
openParens++;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'childNote':
|
||||
condSQL += "itemID IN (SELECT parentItemID FROM "
|
||||
|
|
|
@ -399,6 +399,42 @@ Zotero.SearchConditions = new function(){
|
|||
special: true
|
||||
},
|
||||
|
||||
{
|
||||
name: 'author',
|
||||
operators: {
|
||||
is: true,
|
||||
isNot: true,
|
||||
contains: true,
|
||||
doesNotContain: true
|
||||
},
|
||||
table: 'itemCreators',
|
||||
field: "TRIM(firstName || ' ' || lastName)"
|
||||
},
|
||||
|
||||
{
|
||||
name: 'editor',
|
||||
operators: {
|
||||
is: true,
|
||||
isNot: true,
|
||||
contains: true,
|
||||
doesNotContain: true
|
||||
},
|
||||
table: 'itemCreators',
|
||||
field: "TRIM(firstName || ' ' || lastName)"
|
||||
},
|
||||
|
||||
{
|
||||
name: 'bookAuthor',
|
||||
operators: {
|
||||
is: true,
|
||||
isNot: true,
|
||||
contains: true,
|
||||
doesNotContain: true
|
||||
},
|
||||
table: 'itemCreators',
|
||||
field: "TRIM(firstName || ' ' || lastName)"
|
||||
},
|
||||
|
||||
{
|
||||
name: 'field',
|
||||
operators: {
|
||||
|
@ -669,6 +705,9 @@ Zotero.SearchConditions = new function(){
|
|||
if (str == 'itemType') {
|
||||
str = 'itemTypeID';
|
||||
}
|
||||
else if (['author', 'editor', 'bookAuthor'].includes(str)) {
|
||||
return Zotero.CreatorTypes.getLocalizedString(str);
|
||||
}
|
||||
|
||||
try {
|
||||
return Zotero.getString('searchConditions.' + str)
|
||||
|
|
Loading…
Reference in a new issue