diff --git a/framework/core/src/Core/Events/DiscussionSearchWillBePerformed.php b/framework/core/src/Core/Events/DiscussionSearchWillBePerformed.php new file mode 100644 index 000000000..f36addf52 --- /dev/null +++ b/framework/core/src/Core/Events/DiscussionSearchWillBePerformed.php @@ -0,0 +1,16 @@ +searcher = $searcher; + $this->criteria = $criteria; + } +} diff --git a/framework/core/src/Core/Events/SearchWillBePerformed.php b/framework/core/src/Core/Events/UserSearchWillBePerformed.php similarity index 55% rename from framework/core/src/Core/Events/SearchWillBePerformed.php rename to framework/core/src/Core/Events/UserSearchWillBePerformed.php index 7e141f1bb..731a0f990 100644 --- a/framework/core/src/Core/Events/SearchWillBePerformed.php +++ b/framework/core/src/Core/Events/UserSearchWillBePerformed.php @@ -1,14 +1,14 @@ searcher = $searcher; $this->criteria = $criteria; diff --git a/framework/core/src/Core/Search/Discussions/DiscussionSearcher.php b/framework/core/src/Core/Search/Discussions/DiscussionSearcher.php index c5e5633ec..8c393415e 100644 --- a/framework/core/src/Core/Search/Discussions/DiscussionSearcher.php +++ b/framework/core/src/Core/Search/Discussions/DiscussionSearcher.php @@ -5,11 +5,11 @@ use Flarum\Core\Search\SearcherInterface; use Flarum\Core\Search\GambitManager; use Flarum\Core\Repositories\DiscussionRepositoryInterface; use Flarum\Core\Repositories\PostRepositoryInterface; -use Flarum\Core\Events\SearchWillBePerformed; +use Flarum\Core\Events\DiscussionSearchWillBePerformed; class DiscussionSearcher implements SearcherInterface { - public $query; + protected $query; protected $relevantPosts = []; @@ -72,7 +72,7 @@ class DiscussionSearcher implements SearcherInterface $this->query->take($limit + 1); } - event(new SearchWillBePerformed($this, $criteria)); + event(new DiscussionSearchWillBePerformed($this, $criteria)); $discussions = $this->query->get(); diff --git a/framework/core/src/Core/Search/Users/UserSearcher.php b/framework/core/src/Core/Search/Users/UserSearcher.php index 16ce9e0b0..3265219d6 100644 --- a/framework/core/src/Core/Search/Users/UserSearcher.php +++ b/framework/core/src/Core/Search/Users/UserSearcher.php @@ -60,6 +60,8 @@ class UserSearcher implements SearcherInterface $this->query->take($limit + 1); } + event(new UserSearchWillBePerformed($this, $criteria)); + $users = $this->query->get(); if ($count > 0 && $areMoreResults = $users->count() > $count) {