-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Rainlab Forum? #75
Comments
You can actually add this pretty easy yourself by creating a custom plugin, then add this to the boot method (see https://github.com/OFFLINE-GmbH/oc-site-search-plugin#add-support-for-custom-plugin-contents): public function boot()
{
\Event::listen('offline.sitesearch.query', function ($query) {
$items = \RainLab\Forum\Models\Post::where('subject', 'like', "%${query}%")
->orWhere('content', 'like', "%${query}%")
->get();
$results = $items->map(function ($item) use ($query) {
$relevance = mb_stripos($item->subject, $query) !== false ? 2 : 1;
return [
'title' => $item->subject,
'text' => $item->content,
'url' => '/post-url/' . $item->id,
'relevance' => $relevance,
];
});
return [
'provider' => 'Post',
'results' => $results,
];
});
} Makre sure to fix the Do the same again for channels or whatever data you need in the search results. Will this work for you? |
Thanks, I have no idea as I'm not a developer, rather a user/administrator. I'll see whether this helps the folk who would need to implement. I was asking more from the perspective of a user, who saw a list of supported plugins including other RainLab ones, and wondering if their forums were likely to be added at some point as a supported plugin. Thanks for the speedy reply! |
I'll leave this issue open in case anyone has some spare time to implement it. It's not that complicated and would be a great addition to the plugin. |
Hello,
I wondered if there was any possibility of supporting the RainLab Forum: https://octobercms.com/plugin/rainlab-forum to enable indexing of forum categories and posts?
The text was updated successfully, but these errors were encountered: