21 lines
528 B
Go
Raw Normal View History

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"
)
2017-07-09 02:31:41 +00:00
const maxUsers = 6 * 6
const maxAnime = 5 * 6
2017-07-20 12:26:43 +00:00
const maxPosts = 3
const maxThreads = 3
2017-06-20 20:54:45 +00:00
2017-06-16 23:25:02 +00:00
// Get search page.
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-07-20 12:26:43 +00:00
userResults, animeResults, postResults, threadResults := arn.Search(term, maxUsers, maxAnime, maxPosts, maxThreads)
return ctx.HTML(components.SearchResults(term, userResults, animeResults, postResults, threadResults))
}