src/Sulu/Bundle/PageBundle/Search/EventListener/HitListener.php
public function onHit(HitEvent $event)
    {
        if (false === $event->getMetadata()->reflection->isSubclassOf(BasePageDocument::class)) {
            return;
        }

        $document = $event->getHit()->getDocument();
        if ('/' !== $document->getUrl()[0]) {
            // is absolute URL

            return;
        }

        $url = sprintf(
            '%s/%s',
            rtrim($this->requestAnalyzer->getResourceLocatorPrefix(), '/'),
            ltrim($document->getUrl(), '/')
        );

        $document->setUrl($url);
    }
public function onHit(HitEvent $event)
    {
        if (false === $event->getMetadata()->reflection->isSubclassOf(BasePageDocument::class)) {
            return;
        }

        $document = $event->getHit()->getDocument();
        if ('/' !== $document->getUrl()[0]) {
            // is absolute URL

            return;
        }

        $url = sprintf(
            '%s/%s',
            rtrim($this->requestAnalyzer->getResourceLocatorPrefix(), '/'),
            ltrim($document->getUrl(), '/')
        );

        $document->setUrl($url);
    }
public function onHit ( HitEvent $ event ) { if ( false === $ event -> getMetadata ( ) -> reflection -> isSubclassOf ( BasePageDocument :: class ) ) { return ; } $ document = $ event -> getHit ( ) -> getDocument ( ) ; if ( '/' !== $ document -> getUrl ( ) [ 0 ] ) { // is absolute URL return ; } $ url = sprintf ( '%s/%s' , rtrim ( $ this -> requestAnalyzer -> getResourceLocatorPrefix ( ) , '/' ) , ltrim ( $ document -> getUrl ( ) , '/' ) ) ; $ document -> setUrl ( $ url ) ; }
Prefix url of document with current resourcelocator prefix.

@param HitEvent $event
Prefix url of document with current resourcelocator prefix .