diff --git a/osu.ElasticIndexer/Commands/Queue/PumpAllScoresCommand.cs b/osu.ElasticIndexer/Commands/Queue/PumpAllScoresCommand.cs index f61012d..086c14f 100644 --- a/osu.ElasticIndexer/Commands/Queue/PumpAllScoresCommand.cs +++ b/osu.ElasticIndexer/Commands/Queue/PumpAllScoresCommand.cs @@ -22,6 +22,9 @@ public class PumpAllScoresCommand [Option("--switch", Description = "Update the configured schema in redis after completing.")] public bool Switch { get; set; } + [Option(Description = "Optional where clause", Template = "--where")] + public string Where { get; set; } = "1 = 1"; + [Option("--include-unranked", Description = "Pump scores with ranked flag set to false to trigger deletion")] public bool IncludeUnranked { get; set; } @@ -69,7 +72,7 @@ public int OnExecute(CancellationToken cancellationToken) using (var mySqlConnection = processor.GetDatabaseConnection()) { - var chunks = ElasticModel.Chunk(mySqlConnection, "preserve = 1 " + (IncludeUnranked ? string.Empty : "AND ranked = 1"), AppSettings.BatchSize, from); + var chunks = ElasticModel.Chunk(mySqlConnection, "preserve = 1 " + (IncludeUnranked ? string.Empty : "AND ranked = 1") + $" AND {Where}", AppSettings.BatchSize, from); Score? last = null; foreach (var scores in chunks)