diff --git a/framework/core/src/Core/Search/Discussions/DiscussionSearcher.php b/framework/core/src/Core/Search/Discussions/DiscussionSearcher.php index 8c393415e..d4b7d74c8 100644 --- a/framework/core/src/Core/Search/Discussions/DiscussionSearcher.php +++ b/framework/core/src/Core/Search/Discussions/DiscussionSearcher.php @@ -13,6 +13,8 @@ class DiscussionSearcher implements SearcherInterface protected $relevantPosts = []; + protected $activeGambits = []; + protected $gambits; protected $discussions; @@ -44,6 +46,16 @@ class DiscussionSearcher implements SearcherInterface return $this->query->getQuery(); } + public function addActiveGambit($gambit) + { + $this->activeGambits[] = $gambit; + } + + public function getActiveGambits() + { + return $this->activeGambits; + } + public function search(DiscussionSearchCriteria $criteria, $limit = null, $offset = 0, $load = []) { $this->user = $criteria->user; diff --git a/framework/core/src/Core/Search/GambitManager.php b/framework/core/src/Core/Search/GambitManager.php index 283fa253a..6b91ac599 100644 --- a/framework/core/src/Core/Search/GambitManager.php +++ b/framework/core/src/Core/Search/GambitManager.php @@ -48,6 +48,7 @@ class GambitManager foreach ($bits as $k => $bit) { foreach ($gambits as $gambit) { if ($gambit->apply($bit, $searcher)) { + $searcher->addActiveGambit($gambit); unset($bits[$k]); break; } @@ -65,6 +66,7 @@ class GambitManager $gambit = $this->container->make($this->fulltextGambit); + $searcher->addActiveGambit($gambit); $gambit->apply($string, $searcher); }