Skip to content

Commit

Permalink
add ability to search by circle or slider count
Browse files Browse the repository at this point in the history
  • Loading branch information
p2d0 committed Jan 10, 2025
1 parent 88dc4d2 commit 6d3dcd9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/Libraries/Search/BeatmapsetQueryParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions app/Libraries/Search/BeatmapsetSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,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'],
Expand Down
2 changes: 2 additions & 0 deletions app/Libraries/Search/BeatmapsetSearchParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions app/Libraries/Search/BeatmapsetSearchRequestParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ private function parseQuery(): void
'ar' => 'ar',
'artist' => 'artist',
'bpm' => 'bpm',
'circles' => 'countNormal',
'created' => 'created',
'creator' => 'creator',
'cs' => 'cs',
Expand All @@ -221,6 +222,7 @@ private function parseQuery(): void
'length' => 'totalLength',
'od' => 'accuracy',
'ranked' => 'ranked',
'sliders' => 'countSlider',
'source' => 'source',
'stars' => 'difficultyRating',
'status' => 'statusRange',
Expand Down

0 comments on commit 6d3dcd9

Please sign in to comment.