Skip to content

Commit

Permalink
Merge pull request ppy#10718 from Swekka/title-source-filters
Browse files Browse the repository at this point in the history
Add `title` and `source` beatmapset filters
  • Loading branch information
nanaya authored Nov 9, 2023
2 parents 814e23c + 87955e1 commit 1db8536
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 @@ -70,6 +70,12 @@ public static function parse(?string $query): array
case 'artist':
$option = static::makeTextOption($op, $m['value']);
break;
case 'source':
$option = static::makeTextOption($op, $m['value']);
break;
case 'title':
$option = static::makeTextOption($op, $m['value']);
break;
case 'created':
$option = static::makeDateRangeOption($op, $m['value']);
break;
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 @@ -89,6 +89,8 @@ public function getQuery()
$this->addSimpleFilters($query, $nested);
$this->addCreatorFilter($query, $nested);
$this->addTextFilter($query, 'artist', ['artist', 'artist_unicode']);
$this->addTextFilter($query, 'source', ['source']);
$this->addTextFilter($query, 'title', ['title', 'title_unicode']);

$query->filter([
'nested' => [
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 @@ -39,7 +39,9 @@ class BeatmapsetSearchParams extends SearchParams
public bool $showFollows = false;
public bool $showRecommended = false;
public bool $showSpotlights = false;
public ?string $source = null;
public ?string $status = null;
public ?string $title = null;
public ?array $statusRange = null;
public ?array $hitLength = null;
public ?array $updated = 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 @@ -225,8 +225,10 @@ private function parseQuery(): void
'length' => 'hitLength',
'od' => 'accuracy',
'ranked' => 'ranked',
'source' => 'source',
'stars' => 'difficultyRating',
'status' => 'statusRange',
'title' => 'title',
'updated' => 'updated',
];

Expand Down

0 comments on commit 1db8536

Please sign in to comment.