Skip to content

Commit 62ac40d

Browse files
committed
Fix beatmap search simple keyword exclusion still being included
1 parent 727fab4 commit 62ac40d

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

app/Libraries/Search/BeatmapsetSearch.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function getQuery()
4545
'title_unicode',
4646
'title_unicode.*',
4747
'tags^0.5',
48+
'user_tags',
4849
];
4950

5051
$query = new BoolQuery();
@@ -61,12 +62,6 @@ public function getQuery()
6162
->should(['term' => ['_id' => ['value' => $this->params->queryString, 'boost' => 100]]])
6263
->should(QueryHelper::queryString($this->params->queryString, $partialMatchFields, 'or', 1 / count($terms)))
6364
->should(QueryHelper::queryString($this->params->queryString, [], 'and'))
64-
->should([
65-
'nested' => [
66-
'path' => 'beatmaps',
67-
'query' => QueryHelper::queryString($this->params->queryString, ['beatmaps.top_tags'], 'or', 0.5 / count($terms)),
68-
],
69-
])
7065
);
7166
}
7267

app/Models/Traits/Es/BeatmapsetSearch.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use App\Models\Beatmap;
99
use Carbon\Carbon;
10+
use Ds\Set;
1011

1112
trait BeatmapsetSearch
1213
{
@@ -68,8 +69,14 @@ private function esBeatmapsetValues()
6869
continue;
6970
}
7071

72+
$userTags = new Set();
73+
foreach ($this->beatmaps as $beatmap) {
74+
$userTags->add(...$this->esBeatmapTags($beatmap));
75+
}
76+
7177
$value = match ($field) {
7278
'id' => $this->getKey(),
79+
'user_tags' => $userTags,
7380
default => $this->$field,
7481
};
7582

config/schemas/beatmapsets.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@
243243
"user_id": {
244244
"type": "long"
245245
},
246+
"user_tags": {
247+
"type": "text"
248+
},
246249
"video": {
247250
"type": "boolean"
248251
}

0 commit comments

Comments
 (0)