- Issue created by @Nixou
The Search Api original $query
object comes with a ConditionGroup
at its root.
When calling $query->addConditionGroup($filter->queryCondition($query));
into jsonapi_search_api/src/Resource/IndexResource.phpIndexResource::applyFiltersToQuery()
it adds a group into the root group of the $query
object.
The final organization is :
Query Original Root Group created by Search Api
> Root Group created by Json Api Search Api
> ... conditions / groups provided by the query
This is not how Search Api does it through Views and it's not compatible with how Search Api SOLR will factorize the groups and tags in its createFilterQueries()
methods.
In the end, facets tags are associated with all query filters even if they are not a facet filters and this leads to incorrect facets count.
1. Using Search Api and Search Api SOLR, create a query with non facet filters (for example per language and per category) and facet filters (for example per product characteristic)
2. Put each filters in its own group
3. Perform the query and see that facets counts include results from other languages and categories
Instead of creating an additonnal root group, just fill the original root group provided in the query, so the final organization will be :
Query Original Root Group created by Search Api
> ... conditions / groups provided by the query
Active
1.0
Code