Issue
- Add 2 or more Facet Widgets of the same type to a page, for example Category Facet.
- If you make a search and select a facet value in one of the widgets, the same facet value in the other widgets will be selected as well.
- How can I have multiple facets of the same type and achieve a combining AND behavior?
- Facet 1 (from Facet Widget 1) AND Facet 2 (from Facet Widget 2) AND ...
Environment
- DXP 7.2
- DXP 7.3
- DXP 7.4
Resolution
- Selecting a facet term adds a new parameter to the the URL. For instance, for a Category Facet you get:
/search?q=test&category=1234
. - The name of this parameter is always the same by default for Facets of the same type, but it can be changed in the Facet Configuration menu, under "{{Type}} Parameter Name" (where {{Type}} corresponds to the type of Facet: Category, Tag, etc.).
- If the parameter names are not the same for the Facets, they will appear in the URL and the search result will match all of the filter criteria.
- For example, if the parameter name for Facet 1 is main-category, and for Facet 2 is sec-category, the URL will have this format:
/search?q=test&main-category=1234&sec-category=4321
.
- For example, if the parameter name for Facet 1 is main-category, and for Facet 2 is sec-category, the URL will have this format:
- Note that, when selecting values from the same Facet Widget, it gives a combining OR behavior. So by adding further Facet Widgets of the same type and customizing their "{{Type}} Parameter Name" allows any boolean combining behavior.
- For example, (Facet 1 OR Facet 2 OR Facet 3) AND (Facet 4 OR Facet 5).
Additional Information
Subscriber Exclusive Content
A Liferay Enterprise Subscription provides access to over 1,500 articles that include best practices, troubleshooting, and other valuable solutions. Sign in for full access.
Sign In