diff --git a/app/Libraries/Search/BeatmapsetQueryParser.php b/app/Libraries/Search/BeatmapsetQueryParser.php index faa4f51b8cd..24d3e16b040 100644 --- a/app/Libraries/Search/BeatmapsetQueryParser.php +++ b/app/Libraries/Search/BeatmapsetQueryParser.php @@ -41,6 +41,12 @@ public static function parse(?string $query): array case 'bpm': $option = static::makeFloatRangeOption($op, $m['value'], 0.01 / 2); break; + case 'circles': + $option = static::makeIntRangeOption($op, $m['value']); + break; + case 'sliders': + $option = static::makeIntRangeOption($op, $m['value']); + break; case 'length': $parsed = get_length_seconds($m['value']); if ($parsed !== null) { diff --git a/app/Libraries/Search/BeatmapsetSearch.php b/app/Libraries/Search/BeatmapsetSearch.php index f88edc7f930..2d8b1b132fe 100644 --- a/app/Libraries/Search/BeatmapsetSearch.php +++ b/app/Libraries/Search/BeatmapsetSearch.php @@ -108,6 +108,7 @@ public function getQuery() ]); } + return $query; } @@ -307,6 +308,8 @@ private function addSimpleFilters(BoolQuery $query, BoolQuery $nested): void 'accuracy' => ['field' => 'beatmaps.diff_overall', 'type' => 'range'], 'ar' => ['field' => 'beatmaps.diff_approach', 'type' => 'range'], 'bpm' => ['field' => 'bpm', 'type' => 'range'], + 'countNormal' => ['field' => 'beatmaps.countNormal', 'type' => 'range'], + 'countSlider' => ['field' => 'beatmaps.countSlider', 'type' => 'range'], 'created' => ['field' => 'submit_date', 'type' => 'range'], 'cs' => ['field' => 'beatmaps.diff_size', 'type' => 'range'], 'difficultyRating' => ['field' => 'beatmaps.difficultyrating', 'type' => 'range'], @@ -320,12 +323,10 @@ private function addSimpleFilters(BoolQuery $query, BoolQuery $nested): void static $nestedPrefix = 'beatmaps.'; $nestedPrefixLength = strlen($nestedPrefix); - foreach ($filters as $prop => $options) { if ($this->params->$prop === null) { continue; } - $q = substr($options['field'], 0, $nestedPrefixLength) === $nestedPrefix ? $nested : $query; $q->filter([$options['type'] => [$options['field'] => $this->params->$prop]]); } diff --git a/app/Libraries/Search/BeatmapsetSearchParams.php b/app/Libraries/Search/BeatmapsetSearchParams.php index 9cbd9b9e0d9..03cce272fbd 100644 --- a/app/Libraries/Search/BeatmapsetSearchParams.php +++ b/app/Libraries/Search/BeatmapsetSearchParams.php @@ -19,6 +19,8 @@ class BeatmapsetSearchParams extends SearchParams public ?array $ar = null; public ?string $artist = null; public ?array $bpm = null; + public ?array $countNormal = null; + public ?array $countSlider = null; public ?array $created = null; public ?string $creator = null; public ?array $cs = null; diff --git a/app/Libraries/Search/BeatmapsetSearchRequestParams.php b/app/Libraries/Search/BeatmapsetSearchRequestParams.php index c070c61139e..21d46a94193 100644 --- a/app/Libraries/Search/BeatmapsetSearchRequestParams.php +++ b/app/Libraries/Search/BeatmapsetSearchRequestParams.php @@ -213,6 +213,7 @@ private function parseQuery(): void 'created' => 'created', 'creator' => 'creator', 'cs' => 'cs', + 'circles' => 'countNormal', 'difficulty' => 'difficulty', 'dr' => 'drain', 'favourites' => 'favouriteCount', @@ -224,6 +225,7 @@ private function parseQuery(): void 'source' => 'source', 'stars' => 'difficultyRating', 'status' => 'statusRange', + 'sliders' => 'countSlider', 'title' => 'title', 'updated' => 'updated', ];