Fix tag autocomplete
Also fixed to not display tags twice if both manual and automatic and to not display automatic tags if manual versions of the same tags are already linked to the current item
This commit is contained in:
parent
72b53e1b3f
commit
8214d7ac60
1 changed files with 5 additions and 5 deletions
|
@ -134,21 +134,21 @@ ZoteroAutoComplete.prototype.startSearch = function(searchString, searchParam,
|
|||
break;
|
||||
|
||||
case 'tag':
|
||||
var sql = "SELECT name FROM tags WHERE name LIKE ?";
|
||||
var sql = "SELECT DISTINCT name FROM tags WHERE name LIKE ?";
|
||||
var sqlParams = [searchString + '%'];
|
||||
if (extra){
|
||||
sql += " AND tagID NOT IN (SELECT tagID FROM itemTags WHERE "
|
||||
+ "itemID = ?)";
|
||||
sql += " AND name NOT IN (SELECT name FROM tags WHERE tagID IN ("
|
||||
+ "SELECT tagID FROM itemTags WHERE itemID = ?))";
|
||||
sqlParams.push(extra);
|
||||
}
|
||||
|
||||
var results = this._zotero.DB.columnQuery(sql, sqlParams);
|
||||
if (results) {
|
||||
var collation = Zotero.getLocaleCollation();
|
||||
var collation = this._zotero.getLocaleCollation();
|
||||
results.sort(function(a, b) {
|
||||
return collation.compareString(1, a, b);
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'creator':
|
||||
|
|
Loading…
Add table
Reference in a new issue