From 1bbda2c96a40fe908b0acc20416e6ca5586c9979 Mon Sep 17 00:00:00 2001 From: kilo Date: Wed, 8 Nov 2017 14:41:39 +0100 Subject: [PATCH] Fix sukebei fromID search (#1722) * Update sortmode.go * Update torrentParam.go --- utils/search/sortmode.go | 2 +- utils/search/torrentParam.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/search/sortmode.go b/utils/search/sortmode.go index 8d097696..2facb10d 100644 --- a/utils/search/sortmode.go +++ b/utils/search/sortmode.go @@ -21,7 +21,7 @@ type SortField struct { } var sortFields = []SortField{ - {"id", "torrents.torrent_id"}, + {"id", config.Get().Models.TorrentsTableName + ".torrent_id"}, {"name.raw", "torrent_name"}, {"date", "date"}, {"downloads", "downloads"}, diff --git a/utils/search/torrentParam.go b/utils/search/torrentParam.go index 97ecbc8e..394ae4cc 100644 --- a/utils/search/torrentParam.go +++ b/utils/search/torrentParam.go @@ -13,6 +13,7 @@ import ( elastic "gopkg.in/olivere/elastic.v5" + "github.com/NyaaPantsu/nyaa/config" "github.com/NyaaPantsu/nyaa/models" "github.com/NyaaPantsu/nyaa/models/torrents" "github.com/NyaaPantsu/nyaa/utils/log" @@ -390,11 +391,11 @@ func (p *TorrentParam) toDBQuery(c *gin.Context) *Query { } if p.FromID != 0 { - query.Append("torrents.torrent_id > ?", p.FromID) + query.Append(config.Get().Models.TorrentsTableName + ".torrent_id > ?", p.FromID) } if len(p.TorrentID) > 0 { for _, id := range p.TorrentID { - query.Append("torrents.torrent_id = ?", id) + query.Append(config.Get().Models.TorrentsTableName + ".torrent_id = ?", id) } } if p.FromDate != "" {