2016-11-22 03:34:59 +00:00
|
|
|
package search
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/aerogo/aero"
|
2017-06-20 20:54:45 +00:00
|
|
|
"github.com/animenotifier/arn"
|
|
|
|
"github.com/animenotifier/notify.moe/components"
|
2016-11-22 03:34:59 +00:00
|
|
|
)
|
|
|
|
|
2017-07-02 15:51:17 +00:00
|
|
|
const maxUsers = 9 * 4
|
|
|
|
const maxAnime = 9 * 4
|
2017-06-20 20:54:45 +00:00
|
|
|
|
2017-06-16 23:25:02 +00:00
|
|
|
// Get search page.
|
2016-11-22 03:34:59 +00:00
|
|
|
func Get(ctx *aero.Context) string {
|
2017-07-02 15:51:17 +00:00
|
|
|
term := ctx.Query("q")
|
2017-06-20 20:54:45 +00:00
|
|
|
|
2017-06-20 21:58:20 +00:00
|
|
|
userResults, animeResults := arn.Search(term, maxUsers, maxAnime)
|
2017-06-23 19:05:30 +00:00
|
|
|
return ctx.HTML(components.SearchResults(userResults, animeResults))
|
2016-11-22 03:34:59 +00:00
|
|
|
}
|