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
The problem
Is there a way to filter categories when applying a product facet and only return the categories that match that facet?
Explanation
To be able to get an aggregations for categories in search responses, is enough to pass somehow within a search request an information of using the aggregation by the __outline property when search, this property is presents in index for all catalog objects, but unfortunately the current implementation of search engine doesn’t allow to pass a custom aggregations expression within the search request.
Instead, predefined aggregations are used, they define individually for each store in Aggregations Widget and populated by automatically generated list of expressions (constructed from catalog product properties and they values), where you might manually choose the aggregations types that will be used by default for any search response.
The problem is, the catalog module has an aggregation for catalog properties and for prices but doesn’t have a specific aggregation expression for categories that you requested, and doesn’t have any extension point to add a new aggregations type from code.
Workaround solution
Single solution is to manually set the aggregation element for the category (__ outline) in the resulting JSON, which is generated every time after any modifications in the Aggregations Widget.
To do this you need open Store -> Dynamic Properties in the Filtered Browsing dynamic property add the follow object in Attributes
artem-dudarev
changed the title
Add availability to receive aggregations for categories in product search
Add ability to receive aggregations for categories in product search
Jul 29, 2019
The problem
Is there a way to filter categories when applying a product facet and only return the categories that match that facet?
Explanation
To be able to get an aggregations for categories in search responses, is enough to pass somehow within a search request an information of using the aggregation by the __outline property when search, this property is presents in index for all catalog objects, but unfortunately the current implementation of search engine doesn’t allow to pass a custom aggregations expression within the search request.
Instead, predefined aggregations are used, they define individually for each store in Aggregations Widget and populated by automatically generated list of expressions (constructed from catalog product properties and they values), where you might manually choose the aggregations types that will be used by default for any search response.
The problem is, the catalog module has an aggregation for catalog properties and for prices but doesn’t have a specific aggregation expression for categories that you requested, and doesn’t have any extension point to add a new aggregations type from code.
Workaround solution
Single solution is to manually set the aggregation element for the category (__ outline) in the resulting JSON, which is generated every time after any modifications in the Aggregations Widget.
To do this you need open Store -> Dynamic Properties in the Filtered Browsing dynamic property add the follow object in Attributes
After that all indexed search will return categories outlines in aggregations for any search response.
The list of probably correct solutions
The text was updated successfully, but these errors were encountered: