Skip to content

Commit

Permalink
Set routePath as URL for the search (#488)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Lagler <[email protected]>
  • Loading branch information
martinlagler and Martin Lagler authored Jun 4, 2020
1 parent 3577d18 commit 75bbb26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Search/ArticleSearchSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Massive\Bundle\SearchBundle\Search\Event\PreIndexEvent;
use Massive\Bundle\SearchBundle\Search\Field;
use Massive\Bundle\SearchBundle\Search\SearchEvents;
use Sulu\Bundle\ArticleBundle\Document\Behavior\WebspaceBehavior;
use Sulu\Bundle\ArticleBundle\Document\ArticleDocument;
use Sulu\Bundle\ArticleBundle\Document\Resolver\WebspaceResolver;
use Sulu\Bundle\SearchBundle\Search\Factory;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
Expand Down Expand Up @@ -54,10 +54,12 @@ public function handlePreIndex(PreIndexEvent $event): void
$subject = $event->getSubject();
$document = $event->getDocument();

if (!$subject instanceof WebspaceBehavior) {
if (!$subject instanceof ArticleDocument) {
return;
}

$document->setUrl($subject->getRoutePath());

$document->addField(
$this->factory->createField(
'mainWebspace',
Expand Down

0 comments on commit 75bbb26

Please sign in to comment.