Skip to content

Commit

Permalink
Merge pull request #16392 from lenguyenthanh/lila-search/3.1.0
Browse files Browse the repository at this point in the history
Bump lila-search 3.1.0
  • Loading branch information
ornicar authored Nov 11, 2024
2 parents 7bac214 + da9d611 commit 39763ad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 44 deletions.
8 changes: 2 additions & 6 deletions modules/search/src/main/Env.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import lila.common.autoconfig.*
import lila.search.client.SearchClient

@Module
private class SearchConfig(
val enabled: Boolean,
val writeable: Boolean,
val endpoint: String
)
private class SearchConfig(val enabled: Boolean, val endpoint: String)

@Module
final class Env(
Expand All @@ -25,4 +21,4 @@ final class Env(
val client: SearchClient =
val _client =
if config.enabled then SearchClient.play(ws, s"${config.endpoint}/api") else SearchClient.noop
LilaSearchClient(_client, config.writeable)
LilaSearchClient(_client)
38 changes: 1 addition & 37 deletions modules/search/src/main/LilaSearchClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,7 @@ package lila.search
import lila.search.client.{ SearchClient, SearchError }
import lila.search.spec.*

class LilaSearchClient(client: SearchClient, writeable: Boolean)(using Executor) extends SearchClient:

override def storeBulkTeam(sources: List[TeamSourceWithId]): Future[Unit] =
client.storeBulkTeam(sources)

override def storeBulkStudy(sources: List[StudySourceWithId]): Future[Unit] =
client.storeBulkStudy(sources)

override def storeBulkGame(sources: List[GameSourceWithId]): Future[Unit] =
client.storeBulkGame(sources)

override def storeBulkForum(sources: List[ForumSourceWithId]): Future[Unit] =
client.storeBulkForum(sources)

override def store(id: String, source: Source): Future[Unit] =
writeable.so:
monitor("store", source.index):
client.store(id, source)

override def refresh(index: Index): Future[Unit] =
client.refresh(index)

override def mapping(index: Index): Future[Unit] =
client.mapping(index)

override def deleteById(index: Index, id: String): Future[Unit] =
writeable.so(client.deleteById(index, id))

override def deleteByIds(index: Index, ids: List[Id]): Future[Unit] =
writeable.so(client.deleteByIds(index, ids))
class LilaSearchClient(client: SearchClient)(using Executor) extends SearchClient:

override def count(query: Query): Future[CountOutput] =
monitor("count", query.index):
Expand Down Expand Up @@ -61,10 +32,3 @@ class LilaSearchClient(client: SearchClient, writeable: Boolean)(using Executor)
case q: Query.Game => "game"
case q: Query.Study => "study"
case q: Query.Team => "team"

extension (source: Source)
def index = source match
case s: Source.ForumCase => "forum"
case s: Source.GameCase => "game"
case s: Source.StudyCase => "study"
case s: Source.TeamCase => "team"
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object Dependencies {
val lettuce = "io.lettuce" % "lettuce-core" % "6.5.0.RELEASE"
val nettyTransport =
("io.netty" % s"netty-transport-native-$notifier" % "4.1.114.Final").classifier(s"$os-$arch")
val lilaSearch = "org.lichess.search" %% "client" % "3.0.2"
val lilaSearch = "org.lichess.search" %% "client" % "3.1.0"
val munit = "org.scalameta" %% "munit" % "1.0.2" % Test
val uaparser = "org.uaparser" %% "uap-scala" % "0.18.0"
val apacheText = "org.apache.commons" % "commons-text" % "1.12.0"
Expand Down

0 comments on commit 39763ad

Please sign in to comment.