Skip to content

Commit

Permalink
Tag scores best search
Browse files Browse the repository at this point in the history
  • Loading branch information
nanaya committed Sep 8, 2023
1 parent d2dd0e3 commit 58fa22a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 1 addition & 3 deletions app/Libraries/Elasticsearch/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ abstract class Search extends HasSearch implements Queryable
/**
* A tag to use when logging timing of fetches.
* FIXME: context-based tagging would be nicer.
*
* @var string|null
*/
public $loggingTag;
public ?string $loggingTag;

protected $aggregations;
protected $index;
Expand Down
8 changes: 6 additions & 2 deletions app/Libraries/Score/FetchDedupedScores.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ class FetchDedupedScores
private int $limit;
private array $result;

public function __construct(private string $dedupeColumn, private ScoreSearchParams $params)
{
public function __construct(
private string $dedupeColumn,
private ScoreSearchParams $params,
private ?string $searchLoggingTag = null
) {
$this->limit = $this->params->size;
}

public function all(): array
{
$this->params->size = $this->limit + 50;
$search = new ScoreSearch($this->params);
$search->loggingTag = $this->searchLoggingTag;

$nextCursor = null;
$hasNext = true;
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Traits/UserScoreable.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function aggregatedScoresBest(string $mode, int $size): array
'ruleset_id' => Beatmap::MODES[$mode],
'sort' => 'pp_desc',
'user_id' => $this->getKey(),
])))->all();
]), "aggregatedScoresBest_{$mode}"))->all();
}

public function beatmapBestScoreIds(string $mode)
Expand Down

0 comments on commit 58fa22a

Please sign in to comment.