ignore search failures
some queries are just too heavy
This commit is contained in:
parent
66f2726a25
commit
175bf28b1f
|
@ -46,9 +46,11 @@ final class Search(env: Env) extends LilaController(env) {
|
||||||
failure => Ok(html.search.index(failure, none, nbGames)).fuccess,
|
failure => Ok(html.search.index(failure, none, nbGames)).fuccess,
|
||||||
data =>
|
data =>
|
||||||
data.nonEmptyQuery ?? { query =>
|
data.nonEmptyQuery ?? { query =>
|
||||||
env.gameSearch.paginator(query, page) map (_.some)
|
env.gameSearch.paginator(query, page) map some
|
||||||
} map { pager =>
|
} map { pager =>
|
||||||
Ok(html.search.index(searchForm fill data, pager, nbGames))
|
Ok(html.search.index(searchForm fill data, pager, nbGames))
|
||||||
|
} recover { _ =>
|
||||||
|
InternalServerError("Sorry, we can't process that query at the moment")
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
api = _ =>
|
api = _ =>
|
||||||
|
@ -59,7 +61,7 @@ final class Search(env: Env) extends LilaController(env) {
|
||||||
}.fuccess,
|
}.fuccess,
|
||||||
data =>
|
data =>
|
||||||
data.nonEmptyQuery ?? { query =>
|
data.nonEmptyQuery ?? { query =>
|
||||||
env.gameSearch.paginator(query, page).dmap(_.some)
|
env.gameSearch.paginator(query, page) dmap some
|
||||||
} flatMap {
|
} flatMap {
|
||||||
case Some(s) =>
|
case Some(s) =>
|
||||||
env.api.userGameApi.jsPaginator(s) dmap {
|
env.api.userGameApi.jsPaginator(s) dmap {
|
||||||
|
@ -67,6 +69,8 @@ final class Search(env: Env) extends LilaController(env) {
|
||||||
}
|
}
|
||||||
case None =>
|
case None =>
|
||||||
BadRequest(jsonError("Could not process search query")).fuccess
|
BadRequest(jsonError("Could not process search query")).fuccess
|
||||||
|
} recover { _ =>
|
||||||
|
InternalServerError(jsonError("Sorry, we can't process that query at the moment"))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue