From c40727559628904ba7b812fbae6892e04f3fda42 Mon Sep 17 00:00:00 2001 From: Carbrex <95964955+Carbrex@users.noreply.github.com> Date: Wed, 13 Mar 2024 02:48:24 +0530 Subject: [PATCH 1/2] Tried fixing standard not working in `/games/search` --- app/game.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/game.scala b/app/game.scala index 2771d610..57f6e0a7 100644 --- a/app/game.scala +++ b/app/game.scala @@ -58,7 +58,7 @@ case class Query( winner: Option[String] = None, loser: Option[String] = None, winnerColor: Option[Int] = None, - perf: Option[Int] = None, + perf: Range[Int] = Range.none, source: Option[Int] = None, status: Option[Int] = None, turns: Range[Int] = Range.none, @@ -98,7 +98,7 @@ case class Query( date map Date.formatter.print queries Fields.date, hasAiQueries, (hasAi | true).fold(aiLevel queries Fields.ai, Nil), - toQueries(perf, Fields.perf), + perf queries Fields.perf, toQueries(source, Fields.source), toQueries(rated, Fields.rated), toQueries(status, Fields.status), From 978a19ec969510c97a3725907078846102ca557c Mon Sep 17 00:00:00 2001 From: Carbrex <95964955+Carbrex@users.noreply.github.com> Date: Wed, 13 Mar 2024 16:23:38 +0530 Subject: [PATCH 2/2] Update perf field to use List instead of Range we cant perform range queries on keywords as mentioned https://github.com/lichess-org/lila/issues/14299#issuecomment-1992608687 --- app/game.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/game.scala b/app/game.scala index 57f6e0a7..fd9fb2a4 100644 --- a/app/game.scala +++ b/app/game.scala @@ -58,7 +58,7 @@ case class Query( winner: Option[String] = None, loser: Option[String] = None, winnerColor: Option[Int] = None, - perf: Range[Int] = Range.none, + perf: List[Int] = List.empty, source: Option[Int] = None, status: Option[Int] = None, turns: Range[Int] = Range.none, @@ -98,7 +98,7 @@ case class Query( date map Date.formatter.print queries Fields.date, hasAiQueries, (hasAi | true).fold(aiLevel queries Fields.ai, Nil), - perf queries Fields.perf, + if (perf.nonEmpty) List(termsQuery(Fields.perf, perf)) else Nil, toQueries(source, Fields.source), toQueries(rated, Fields.rated), toQueries(status, Fields.status),