This guide explains how to configure Liferay Blueprint to filter web content articles based on tag or structure ID using a custom JSON element.
Create a Liferay Blueprint
- Go to Control Panel > Search Experiences > Blueprints.
- Click Add to create a new blueprint.
- Provide a name, for example:
News or Structured Content
.
Add a Custom JSON Element
- In the Blueprint editor, click the + icon.
- Select Custom JSON.
- Add the following JSON to filter articles tagged with
news
or having a specific structure key:
{
"must": [
{
"bool": {
"should": [
{
"term": {
"assetTagNames": "news"
}
},
{
"term": {
"ddmStructureKey": "237068"
}
}
]
}
}
]
}
- Click Save to apply the JSON.
Attach the Blueprint to a Search Page
- Open the page that uses the Search Results widget.
- Click the Options icon and choose Configuration.
- Select the newly created blueprint from the dropdown.
- Save the configuration.
Notes
assetTagNames
matches tag names. Make sure the article is tagged correctly.ddmStructureKey
is the key of the web content structure, not the numeric ID.- Use the Query Inspector to verify what filters are applied when searching.
This approach allows you to combine tag-based and structure-based filtering using a logical OR condition inside Liferay’s search framework.
Also Read: How to Fetch a Category Name Using Category ID in Liferay with FreeMarker