Skip to content

Commit

Permalink
fix game search export
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Sep 3, 2015
1 parent b39c50d commit 1a5cc43
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/Search.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions modules/gameSearch/src/main/GameSearchApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 0 additions & 2 deletions modules/search/src/main/PaginatorBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1a5cc43

Please sign in to comment.