Skip to content

Commit b1a66b9

Browse files
committed
move nested must_not and comment
1 parent c7d2661 commit b1a66b9

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

app/Libraries/Search/BeatmapsetSearch.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ public function getQuery(): Queryable
122122
],
123123
]);
124124

125+
// The inverse of nested:filter/must is must_not:nested, not nested:must_not
126+
// https://github.com/elastic/elasticsearch/issues/26264#issuecomment-323668358
125127
if (!$this->nestedMustNot->isEmpty()) {
126128
$this->query->mustNot([
127129
'nested' => [
@@ -291,14 +293,7 @@ private function addPlayedFilter()
291293
if ($this->params->playedFilter === 'played') {
292294
$this->nested->filter(['terms' => ['beatmaps.beatmap_id' => $this->getPlayedBeatmapIds()]]);
293295
} elseif ($this->params->playedFilter === 'unplayed') {
294-
// The inverse of nested:filter/must is must_not:nested, not nested:must_not
295-
// https://github.com/elastic/elasticsearch/issues/26264#issuecomment-323668358
296-
$this->query->mustNot([
297-
'nested' => [
298-
'path' => 'beatmaps',
299-
'query' => ['terms' => ['beatmaps.beatmap_id' => $this->getPlayedBeatmapIds()]],
300-
],
301-
]);
296+
$this->nestedMustNot->should(['terms' => ['beatmaps.beatmap_id' => $this->getPlayedBeatmapIds()]]);
302297
}
303298
}
304299

0 commit comments

Comments
 (0)