Prevent indexing tracks that shouldn't be indexed

This commit is contained in:
Adam Lavin 2021-05-01 00:39:43 +01:00
parent 2af5799564
commit 8df8f73b32
No known key found for this signature in database
GPG key ID: 9C4C68AFA9CA6461

View file

@ -82,6 +82,11 @@ trait IndexedInElasticsearchTrait
*/ */
public function updateElasticsearchEntry(bool $removeFromIndex = false) public function updateElasticsearchEntry(bool $removeFromIndex = false)
{ {
// If it shouldn't be indexed, always force a removal from the index.
if (!$this->shouldBeIndexed()) {
$removeFromIndex = true;
}
$job = (new UpdateSearchIndexForEntity($this->getElasticsearchParameters(!$removeFromIndex), $removeFromIndex))->onQueue(config('ponyfm.indexing_queue')); $job = (new UpdateSearchIndexForEntity($this->getElasticsearchParameters(!$removeFromIndex), $removeFromIndex))->onQueue(config('ponyfm.indexing_queue'));
$this->dispatch($job); $this->dispatch($job);
} }