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:
Dan Stillman 2008-06-16 15:11:59 +00:00
parent 72b53e1b3f
commit 8214d7ac60

View file

@ -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':