Back to SiteSearch Support

simon75475
simon75475

Hi,

I use a custom block for entering content in static pages and I use SiteSearch plugin included in static pages. The search works and returns results, the results page shows page title and URL for each resulted page but no excerpt. Can you give me some ideas of what should be done to have also excerpts shown on search results page?

Thanks! Simon

OFFLINE
OFFLINE

Try to debug around here what the parsedMarkup or getViewBagPropValue properties return in your case:

https://github.com/OFFLINE-GmbH/oc-site-search-plugin/blob/develop/classes/providers/RainlabPagesResultsProvider.php#L48

simon75475
simon75475

Hi,

Thanks for your answer! Checking my RainlabPagesResultsProvider.php provider class I have observed the search method code base differs from your GitHub code. In fact my search method looks like the following: public function search() { if ( ! $this->isInstalledAndEnabled()) { return $this; }

    foreach ($this->pages() as $page) {
        // Make this result more relevant, if the query is found in the title
        $title     = $page->viewBag['meta_title'] ?? $page->viewBag['title'] ?? '';
        $relevance = $this->containsQuery($title) ? 2 : 1;

        $result        = new Result($this->query, $relevance);
        $result->title = $title;
        $result->text  = $page->parsedMarkup;
        $result->url   = $this->getUrl($page);
        $result->model = $page;

        $this->addResult($result);
    }
    return $this;
}

I tested your code and everything works well, I can see excerpts. But probably at the next plugin update the code will change.

The SiteSearch plugin version I have installed is 1.5.6.

How should I proceed in this case? What's your advise?

Best regards, Simon

1-3 of 3