This is a discussion that mirrors the GitHub issue I just created at flarum/core2712
Custom searchers aren't used a lot in Flarum community extensions, but they have received an overhaul in the last release. Unfortunately they are also broken.
I personally have two impacted extensions, but I don't know of any other extension that uses custom searchers. The idea for now is to leave this as it is and fix it in the upcoming build 17 (RC2 or stable). If the impact is larger, we will consider releasing a patch release.
If anyone encounters this issue, a workaround can be implemented using a service provider:
<?php
namespace Kilowhat\Audit\Providers;
use Flarum\Foundation\AbstractServiceProvider;
use Kilowhat\Audit\Search\AuditSearcher;
use Kilowhat\Audit\Search\Gambits\NoOpFullTextGambit;
class SearchServiceProvider extends AbstractServiceProvider
{
public function register()
{
// Workaround for https://github.com/flarum/core/issues/2712
$this->container->extend('flarum.simple_search.fulltext_gambits', function ($oldFulltextGambits) {
$oldFulltextGambits[AuditSearcher::class] = NoOpFullTextGambit::class;
return $oldFulltextGambits;
});
}
}
And in extend.php
:
(new Extend\ServiceProvider())
->register(Providers\SearchServiceProvider::class),
It replaces the non-functional following extender call:
(new Extend\SimpleFlarumSearch(AuditSearcher::class))
->setFullTextGambit(Search\Gambits\NoOpFullTextGambit::class),
It's best to keep the correct extender in place. It does nothing, but won't cause any error either. And having it in the code allows finding extensions that use it via the Query tool.
This issue only affects custom searchers. Defining custom full text gambits for Discussion or User model works as intended using the extender.