Match last name alone for two-field names in search autocomplete
https://forums.zotero.org/discussion/50073/
This commit is contained in:
parent
be4d56e43b
commit
dcd7de03b0
1 changed files with 5 additions and 5 deletions
|
@ -96,11 +96,11 @@ ZoteroAutoComplete.prototype.startSearch = function(searchString, searchParams,
|
|||
if (searchParams.fieldMode == 2) {
|
||||
var sql = "SELECT DISTINCT CASE fieldMode WHEN 1 THEN lastName "
|
||||
+ "WHEN 0 THEN firstName || ' ' || lastName END AS val, NULL AS comment "
|
||||
+ "FROM creators NATURAL JOIN creatorData WHERE CASE fieldMode "
|
||||
+ "WHEN 1 THEN lastName "
|
||||
+ "WHEN 0 THEN firstName || ' ' || lastName END "
|
||||
+ "LIKE ? ";
|
||||
var sqlParams = [searchString + '%'];
|
||||
+ "FROM creators NATURAL JOIN creatorData "
|
||||
+ "WHERE CASE fieldMode "
|
||||
+ "WHEN 1 THEN lastName LIKE ? "
|
||||
+ "WHEN 0 THEN (firstName || ' ' || lastName LIKE ?) OR (lastName LIKE ?) END "
|
||||
var sqlParams = [searchString + '%', searchString + '%', searchString + '%'];
|
||||
if (typeof searchParams.libraryID != 'undefined') {
|
||||
sql += " AND libraryID=?";
|
||||
sqlParams.push(searchParams.libraryID);
|
||||
|
|
Loading…
Reference in a new issue