diff --git a/modules/api/src/main/Cli.scala b/modules/api/src/main/Cli.scala index da551708e9062..ba31e32da96ff 100644 --- a/modules/api/src/main/Cli.scala +++ b/modules/api/src/main/Cli.scala @@ -5,8 +5,6 @@ import lila.web.AnnounceApi final private[api] class Cli( security: lila.security.Env, - teamSearch: lila.teamSearch.Env, - forumSearch: lila.forumSearch.Env, tournament: lila.tournament.Env, fishnet: lila.fishnet.Env, study: lila.study.Env, @@ -55,7 +53,6 @@ final private[api] class Cli( private def processors = security.cli.process - .orElse(teamSearch.cli.process) .orElse(tournament.cli.process) .orElse(fishnet.cli.process) .orElse(study.cli.process) diff --git a/modules/core/src/main/team.scala b/modules/core/src/main/team.scala index f5dc3d3bb5984..1b2dc5536440f 100644 --- a/modules/core/src/main/team.scala +++ b/modules/core/src/main/team.scala @@ -56,8 +56,6 @@ case class TeamData( ) case class TeamCreate(team: TeamData) case class TeamUpdate(team: TeamData, byMod: Boolean)(using val me: MyId) -case class TeamDelete(id: TeamId) -case class TeamDisable(id: TeamId) case class JoinTeam(id: TeamId, userId: UserId) case class IsLeader(id: TeamId, userId: UserId, promise: Promise[Boolean]) case class IsLeaderOf(leaderId: UserId, memberId: UserId, promise: Promise[Boolean]) diff --git a/modules/forumSearch/src/main/Env.scala b/modules/forumSearch/src/main/Env.scala index d9b08fa2af131..9cf51e151072a 100644 --- a/modules/forumSearch/src/main/Env.scala +++ b/modules/forumSearch/src/main/Env.scala @@ -13,11 +13,7 @@ import lila.search.spec.Query @Module private class ForumSearchConfig(@ConfigName("paginator.max_per_page") val maxPerPage: MaxPerPage) -final class Env( - appConfig: Configuration, - postApi: lila.core.forum.ForumPostApi, - client: SearchClient -)(using Executor): +final class Env(appConfig: Configuration, client: SearchClient)(using Executor): private val config = appConfig.get[ForumSearchConfig]("forumSearch")(AutoConfig.loader) diff --git a/modules/forumSearch/src/main/package.scala b/modules/forumSearch/src/main/package.scala index 3604898cd0680..d4301e043437d 100644 --- a/modules/forumSearch/src/main/package.scala +++ b/modules/forumSearch/src/main/package.scala @@ -1,7 +1,6 @@ package lila.forumSearch export lila.core.lilaism.Lilaism.{ *, given } -export lila.common.extensions.* private val logger = lila.log("forumSearch") diff --git a/modules/team/src/main/TeamApi.scala b/modules/team/src/main/TeamApi.scala index e8a1720cf72bc..68999a31ebfcf 100644 --- a/modules/team/src/main/TeamApi.scala +++ b/modules/team/src/main/TeamApi.scala @@ -326,7 +326,7 @@ final class TeamApi( users <- memberRepo.userIdsByTeam(team.id) _ = users.foreach(cached.invalidateTeamIds) _ <- requestRepo.removeByTeam(team.id) - yield publish(TeamDisable(team.id)) + yield () else teamRepo .enable(team) @@ -353,7 +353,6 @@ final class TeamApi( (teamRepo.coll.delete.one($id(team.id)) >> memberRepo.removeByTeam(team.id)).andDo { logger.info(s"delete team ${team.id} by @${by.id}: $explain") - publish(TeamDelete(team.id)) } def syncBelongsTo(teamId: TeamId, userId: UserId): Boolean = diff --git a/modules/teamSearch/src/main/Env.scala b/modules/teamSearch/src/main/Env.scala index aded2a9415838..306435a7f4137 100644 --- a/modules/teamSearch/src/main/Env.scala +++ b/modules/teamSearch/src/main/Env.scala @@ -1,6 +1,5 @@ package lila.teamSearch -import akka.actor.* import com.softwaremill.macwire.* import scalalib.paginator.Paginator @@ -8,10 +7,7 @@ import lila.core.config.ConfigName import lila.search.client.SearchClient import lila.search.spec.Query -final class Env( - client: SearchClient, - teamApi: lila.core.team.TeamApi -)(using Executor, akka.stream.Materializer): +final class Env(client: SearchClient)(using Executor): private val maxPerPage = MaxPerPage(15) @@ -20,14 +16,3 @@ final class Env( lazy val api: TeamSearchApi = wire[TeamSearchApi] def apply(text: String, page: Int): Fu[Paginator[TeamId]] = paginatorBuilder(Query.team(text), page) - - def cli: lila.common.Cli = new: - def process = { case "team" :: "search" :: "reset" :: Nil => - api.reset.inject("done") - } - - lila.common.Bus.subscribeFun("team"): - case lila.core.team.TeamCreate(team) => api.store(team) - case lila.core.team.TeamUpdate(team, _) => api.store(team) - case lila.core.team.TeamDelete(id) => client.deleteById(index, id.value) - case lila.core.team.TeamDisable(id) => client.deleteById(index, id.value) diff --git a/modules/teamSearch/src/main/TeamSearchApi.scala b/modules/teamSearch/src/main/TeamSearchApi.scala index bd7a7c95c14c0..a79ba1d6dc735 100644 --- a/modules/teamSearch/src/main/TeamSearchApi.scala +++ b/modules/teamSearch/src/main/TeamSearchApi.scala @@ -1,45 +1,14 @@ package lila.teamSearch -import akka.stream.scaladsl.* - -import lila.core.team.TeamData import lila.search.* import lila.search.client.SearchClient -import lila.search.spec.{ Query, TeamSource } +import lila.search.spec.Query -final class TeamSearchApi( - client: SearchClient, - teamApi: lila.core.team.TeamApi -)(using Executor, akka.stream.Materializer) - extends SearchReadApi[TeamId, Query.Team]: +final class TeamSearchApi(client: SearchClient)(using Executor) extends SearchReadApi[TeamId, Query.Team]: def search(query: Query.Team, from: From, size: Size) = client .search(query, from, size) - .map: res => - res.hitIds.map(TeamId.apply) + .map(_.hitIds.map(TeamId.apply)) def count(query: Query.Team) = client.count(query).dmap(_.count) - - def store(team: TeamData) = client.storeTeam(team.id.value, toDoc(team)) - - private def toDoc(team: TeamData) = - TeamSource( - name = team.name, - description = team.description.value.take(10000), - nbMembers = team.nbMembers - ) - - def reset = - client.mapping(index) >> { - - logger.info(s"Index to ${index}") - - teamApi.cursor - .documentSource() - .via(lila.common.LilaStream.logRate[TeamData]("team index")(logger)) - .map(t => t.id.value -> toDoc(t)) - .grouped(200) - .mapAsync(1)(xs => client.storeBulkTeam(xs.toList)) - .runWith(Sink.ignore) - } >> client.refresh(index) diff --git a/modules/teamSearch/src/main/package.scala b/modules/teamSearch/src/main/package.scala index 9e3f5b1de4cfb..ac5f2552b6d3c 100644 --- a/modules/teamSearch/src/main/package.scala +++ b/modules/teamSearch/src/main/package.scala @@ -1,7 +1,6 @@ package lila.teamSearch export lila.core.lilaism.Lilaism.{ *, given } -export lila.common.extensions.* private val logger = lila.log("teamSearch")