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) {
|
if (searchParams.fieldMode == 2) {
|
||||||
var sql = "SELECT DISTINCT CASE fieldMode WHEN 1 THEN lastName "
|
var sql = "SELECT DISTINCT CASE fieldMode WHEN 1 THEN lastName "
|
||||||
+ "WHEN 0 THEN firstName || ' ' || lastName END AS val, NULL AS comment "
|
+ "WHEN 0 THEN firstName || ' ' || lastName END AS val, NULL AS comment "
|
||||||
+ "FROM creators NATURAL JOIN creatorData WHERE CASE fieldMode "
|
+ "FROM creators NATURAL JOIN creatorData "
|
||||||
+ "WHEN 1 THEN lastName "
|
+ "WHERE CASE fieldMode "
|
||||||
+ "WHEN 0 THEN firstName || ' ' || lastName END "
|
+ "WHEN 1 THEN lastName LIKE ? "
|
||||||
+ "LIKE ? ";
|
+ "WHEN 0 THEN (firstName || ' ' || lastName LIKE ?) OR (lastName LIKE ?) END "
|
||||||
var sqlParams = [searchString + '%'];
|
var sqlParams = [searchString + '%', searchString + '%', searchString + '%'];
|
||||||
if (typeof searchParams.libraryID != 'undefined') {
|
if (typeof searchParams.libraryID != 'undefined') {
|
||||||
sql += " AND libraryID=?";
|
sql += " AND libraryID=?";
|
||||||
sqlParams.push(searchParams.libraryID);
|
sqlParams.push(searchParams.libraryID);
|
||||||
|
|
Loading…
Reference in a new issue