Search result excerpts
Permalink
Is there a way to show search result excerpts (some text around the search keyword) in my search results, instead of just the page title? This would be a really cool feature and helps the user get a better sense of whether a search result is relevant or not.
Example: I search for "amet", and the result shows:
[...] ipsum dolor sit *amet*, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat [...]
This, using the PageList() API.
Is it already possible somehow? Or would it potentially be a nice new feature for concrete5?
Note that I don't want to iterate through the blocks and find the text containing the keyword, as that would perform badly.
For performance reasons the excerpt should be already contained in the search index.
Example: I search for "amet", and the result shows:
[...] ipsum dolor sit *amet*, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat [...]
This, using the PageList() API.
Is it already possible somehow? Or would it potentially be a nice new feature for concrete5?
Note that I don't want to iterate through the blocks and find the text containing the keyword, as that would perform badly.
For performance reasons the excerpt should be already contained in the search index.
Oh, my bad. I didn't look at the out-of-the-box concrete5 search block. I usually use PageList() directly and thought it returns just an array of Page objects.
There it is:
$r->getPageIndexContent()
Thanks for pointing that out :)
There it is:
$r->getPageIndexContent()
Thanks for pointing that out :)
No worries - all good!
=0)
=0)
Is your search result list using a custom template perhaps.
Could you provide a URL to the site at all?