Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to receive aggregations for categories in product search #236

Closed
tatarincev opened this issue Jul 29, 2019 · 1 comment
Closed
Assignees

Comments

@tatarincev
Copy link
Contributor

tatarincev commented 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.

image

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

{
....
"Attributes":
[
   {
     "Key": "__outline",
      "Values": []
    },
....

image

After that all indexed search will return categories outlines in aggregations for any search response.
image

The list of probably correct solutions

@tatarincev tatarincev added this to the Operations milestone Jul 29, 2019
@artem-dudarev 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
@tatarincev tatarincev self-assigned this Jul 31, 2019
@tatarincev
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant