Fix tags updater and query parser

This commit is contained in:
Las Zenow 2016-09-04 08:18:58 -04:00
parent b7c1d74e83
commit 15e1802a00
2 changed files with 5 additions and 2 deletions

View file

@ -28,15 +28,18 @@ func (db *pgDB) GetTags() ([]string, error) {
}
func (db *pgDB) updateTags() {
var tags []string
err := db.sql.Model(&Book{}).
ColumnExpr("unnest(tags) as tag").
Where("active = true").
Group("tag").
Order("count(*) DESC").
Limit(tagsDisplay).
Select(&db.tags)
Select(&tags)
if err != nil {
log.Error("Error updating tags: ", err)
} else {
db.tags = tags
}
}