2016-11-22 12:34:59 +09:00
|
|
|
package search
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/aerogo/aero"
|
2017-06-20 22:54:45 +02:00
|
|
|
"github.com/animenotifier/arn"
|
|
|
|
"github.com/animenotifier/notify.moe/components"
|
2016-11-22 12:34:59 +09:00
|
|
|
)
|
|
|
|
|
2017-07-09 04:31:41 +02:00
|
|
|
const maxUsers = 6 * 6
|
|
|
|
const maxAnime = 5 * 6
|
2017-06-20 22:54:45 +02:00
|
|
|
|
2017-06-17 01:25:02 +02:00
|
|
|
// Get search page.
|
2016-11-22 12:34:59 +09:00
|
|
|
func Get(ctx *aero.Context) string {
|
2017-07-02 17:51:17 +02:00
|
|
|
term := ctx.Query("q")
|
2017-06-20 22:54:45 +02:00
|
|
|
|
2017-06-20 23:58:20 +02:00
|
|
|
userResults, animeResults := arn.Search(term, maxUsers, maxAnime)
|
2017-07-06 22:26:02 +02:00
|
|
|
return ctx.HTML(components.SearchResults(term, userResults, animeResults))
|
2016-11-22 12:34:59 +09:00
|
|
|
}
|