From the architecture (#2348781: Architecture):
SearchersFacet sources
For example, search api has a server A, and an index A1 and we want to create a facet A1Title on top of this. The form to add facets gives you the option to give your facet a name and whether or not to add a block for it. It then will load all plugins of the type "Facet source" with the filters "search_api" and "index A1". There will be a general plugin for full page contexts (SearchApiFacetSourcePlugin) but also Views specific plugins, which are created automatically (ViewsFacetSourcePluginDeriver).
These plugins come with their own configuration and allow you to select the field that you want to facet on. In both cases, the search api index is known by the plugin and we can fetch the list of fields that are indexed.
The Facet Source Plugin also passes a list of allowed Query Types along, since the Facet Source knows exactly which field you want to facet on.
TODO
- Create FacetSourcePluginManagerInterface interface in src/FacetSource
- Create FacetSourcePluginManager class in src/FacetSource
- Create FacetSourceInterface interface in src/FacetSource
- Create FacetSourcePluginBase class implementing the FacetSourceInterface in src/FacetSource
First define the interfaces, especially the FacetSourceInterface. It should contain methods to retrieve:
- Allowed query types
- Allowed fields
- Any other things?
Furthermore it might be an idea to add a method executeQuery, which is able to execute the native query it is attached to (for instance the view), so the adapter can ask the facet source to execute it's search (the Facet should not be able to do this. Only the adapter).
Comments
Comment #2
borisson_Comment #3
borisson_Comment #5
borisson_I added my work in progress to the main branch. This broke the Integration test, but that's one thing I'll fix today.
There is currently a bug in the code that produces the subform for selecting the facet field twice, that needs to be fixed still.
Comment #7
borisson_@Nick_vh worked on this issue earlier today and posted some of his findings in irc:
I followed up on Nick's last suggestion by disabling page_cache and dynamic_page_cache; that didn't seem to make any difference.
Comment #8
borisson_This ended up being a really stupid typo, thanks for figuring it out @Nick_vh.
Comment #9
borisson_This needs more work for:
Comment #10
borisson_Comment #11
borisson_@Nick_vh already did this. Closing the issue.