You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current Behavior
Beta 16 introduced the new Search API, including the AbstractSearcher class and container-bound gambits.
It's not made super clear in the documentation, but just like for custom frontends, it's assumed that the developer needs to register at least one gambit via Extend\SimpleFlarumSearch for the container bindings to be set up for a new searcher class.
It's also not super clear in the documentation but clear from the source code that a full text gambit must be registered as it's the basis for the SearchServiceProvider to register the bindings.
However registering a full text gambit does not sets up the bindings, and as a result the Searcher class cannot be resolved through the container.
The issue is actually that the full text gambits for new searcher are not saved in the container due to resolving used instead of extend.
Steps to Reproduce
Create custom Searcher class extending AbstractSearcher
Register class with full text gambit (new Extend\SimpleFlarumSearch(MyCustomSearcher::class))->setFullTextGambit(AFullTextGambit::class)
Try resolving MyCustomSearcher
Observe error Illuminate\Contracts\Container\BindingResolutionException: Unresolvable dependency resolving [Parameter #1 [ <required> array $searchMutators ]] in class Flarum\Search\AbstractSearcher in /home/clark/Projects/flarum-beta16/vendor/illuminate/container/Container.php:1057
A dump at line 67 of SearchServiceProvider confirms there is no entry for the new searcher.
Environment
Flarum version: beta 16
Possible Solution
resolving needs to be replaced with extend. Tests need to be added for custom searcher classes.
The text was updated successfully, but these errors were encountered:
There are actually quite a few more extensions impacted than I originally thought.
Published extensions include KILOWHAT Formulaire, KILOWHAT Audit and FoF Pages. It will probably impact FoF Taxonomies whenever I manage to update it for the latest Flarum version.
Carving Contest was also affected but it was a candidate for the new filter system.
It's also impacting two of my WIP extensions, KILOWHAT Cimaise and Flamarkt.
The workaround published on Discuss works great as a temporary solution though, so not too big of an issue.
yixuan
added a commit
to cosname/flarum-chinese-search
that referenced
this issue
Apr 17, 2021
Bug Report
Current Behavior
Beta 16 introduced the new Search API, including the
AbstractSearcher
class and container-bound gambits.It's not made super clear in the documentation, but just like for custom frontends, it's assumed that the developer needs to register at least one gambit via
Extend\SimpleFlarumSearch
for the container bindings to be set up for a new searcher class.It's also not super clear in the documentation but clear from the source code that a full text gambit must be registered as it's the basis for the
SearchServiceProvider
to register the bindings.However registering a full text gambit does not sets up the bindings, and as a result the Searcher class cannot be resolved through the container.
The issue is actually that the full text gambits for new searcher are not saved in the container due to
resolving
used instead ofextend
.Steps to Reproduce
Searcher
class extendingAbstractSearcher
(new Extend\SimpleFlarumSearch(MyCustomSearcher::class))->setFullTextGambit(AFullTextGambit::class)
MyCustomSearcher
Illuminate\Contracts\Container\BindingResolutionException: Unresolvable dependency resolving [Parameter #1 [ <required> array $searchMutators ]] in class Flarum\Search\AbstractSearcher in /home/clark/Projects/flarum-beta16/vendor/illuminate/container/Container.php:1057
A dump at line 67 of
SearchServiceProvider
confirms there is no entry for the new searcher.Environment
Possible Solution
resolving
needs to be replaced withextend
. Tests need to be added for custom searcher classes.The text was updated successfully, but these errors were encountered: