From 021a70a62978a7f45a90d1446954d0ac8954410e Mon Sep 17 00:00:00 2001 From: Thanh Le Date: Sun, 10 Nov 2024 12:20:39 +0100 Subject: [PATCH 1/2] Bump lila-search 3.1.0 Remove all write endpoint from lila-search client as we use lila-search-ingestor for indexing data --- .../search/src/main/LilaSearchClient.scala | 36 ------------------- project/Dependencies.scala | 2 +- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/modules/search/src/main/LilaSearchClient.scala b/modules/search/src/main/LilaSearchClient.scala index e7935a06c6e9..4689b888a413 100644 --- a/modules/search/src/main/LilaSearchClient.scala +++ b/modules/search/src/main/LilaSearchClient.scala @@ -5,35 +5,6 @@ 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)) - override def count(query: Query): Future[CountOutput] = monitor("count", query.index): client @@ -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" diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 89aacb4dd6e3..77df0670a817 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -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" From 31f1ef99801d08b1d1608a4a831fca2225202566 Mon Sep 17 00:00:00 2001 From: Thanh Le Date: Sun, 10 Nov 2024 12:44:41 +0100 Subject: [PATCH 2/2] Remove writable config --- modules/search/src/main/Env.scala | 8 ++------ modules/search/src/main/LilaSearchClient.scala | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/search/src/main/Env.scala b/modules/search/src/main/Env.scala index defd4d21be15..35dcf3c69378 100644 --- a/modules/search/src/main/Env.scala +++ b/modules/search/src/main/Env.scala @@ -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( @@ -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) diff --git a/modules/search/src/main/LilaSearchClient.scala b/modules/search/src/main/LilaSearchClient.scala index 4689b888a413..78102de12dae 100644 --- a/modules/search/src/main/LilaSearchClient.scala +++ b/modules/search/src/main/LilaSearchClient.scala @@ -3,7 +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: +class LilaSearchClient(client: SearchClient)(using Executor) extends SearchClient: override def count(query: Query): Future[CountOutput] = monitor("count", query.index):