From 5d6962f3a503dd30d03441912b07cfb7cf854c94 Mon Sep 17 00:00:00 2001 From: akuma06 Date: Fri, 7 Jul 2017 14:08:16 +0200 Subject: [PATCH] Added search refine back end --- utils/search/structs/torrentParam.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/search/structs/torrentParam.go b/utils/search/structs/torrentParam.go index 3e1b9b97..71f63292 100644 --- a/utils/search/structs/torrentParam.go +++ b/utils/search/structs/torrentParam.go @@ -72,8 +72,9 @@ func (p *TorrentParam) FromRequest(c *gin.Context) { if c.Query("order") == "true" { ascending = true } + langs := c.QueryArray("lang") - language := ParseLanguages(c.Query("lang")) + language := ParseLanguages(strings.Join(langs, ",")) p.NameLike = nameLike p.Max = uint32(max) @@ -152,7 +153,7 @@ func (p *TorrentParam) ToFilterQuery() string { query += " filesize: [* " + sMaxSize + "]" } - if len(p.Languages) > 0{ + if len(p.Languages) > 0 { for _, val := range p.Languages { query += " language: " + val.Code } @@ -239,7 +240,7 @@ func (p *TorrentParam) Clone() TorrentParam { ToDate: p.ToDate, NotNull: p.NotNull, NameLike: p.NameLike, - Languages: p.Languages, + Languages: p.Languages, MinSize: p.MinSize, MaxSize: p.MaxSize, }