Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump lila-search 3.1.0 #16392

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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