fix game search export

pull/889/head
Thibault Duplessis 2015-09-03 22:50:49 +02:00
parent b39c50de5d
commit 1a5cc43919
3 changed files with 4 additions and 3 deletions

View File

@ -35,7 +35,7 @@ object Search extends LilaController {
searchForm.bindFromRequest.fold(
failure => Ok(html.search.index(failure)).fuccess,
data => data.nonEmptyQuery ?? { query =>
env.paginator.ids(query, 5000) map { ids =>
env.api.ids(query, 5000) map { ids =>
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
val date = (DateTimeFormat forPattern "yyyy-MM-dd") print new DateTime

View File

@ -20,6 +20,9 @@ final class GameSearchApi(client: ESClient) extends SearchReadApi[Game, Query] {
def count(query: Query) =
client.count(query) map (_.count)
def ids(query: Query, max: Int): Fu[List[String]] =
client.search(query, From(0), Size(max)).map(_.ids)
def store(game: Game) = storable(game) ?? {
GameRepo isAnalysed game.id flatMap { analysed =>
client.store(Id(game.id), toDoc(game, analysed))

View File

@ -14,8 +14,6 @@ final class PaginatorBuilder[A, Q : Writes](
currentPage = page,
maxPerPage = maxPerPage)
def ids(query: Q, max: Int): Fu[List[String]] = ???
private final class ESAdapter(query: Q) extends AdapterLike[A] {
def nbResults = searchApi count query