Search Blueprints

Collections with Search Blueprints

When you create a search blueprint, you can enable it as a collection provider to display its results. Assets matching the blueprint’s query and configuration are added to the collection.

Search blueprints are registered as collection providers.

Beginning in 2025.Q3, the searchable types you define in a blueprint determine which fields can be mapped within a Collection Display fragment. To access specific metadata, you must define the source of your blueprint:

  • Single Content Type: Select one specific type (e.g., an object or a specific web content structure) to map its unique, custom fields.
  • Multiple or All Types: If you select multiple types, you can map the basic fields common to all assets (e.g., Title, Create Date).
  • Single Type with Multiple Subtypes: If you select one parent type with multiple subtypes (e.g., several different Web Content Structures), only the fields common to the parent type are available.
Important

Prior to DXP 2025.Q3, the collection provider only returned content registered with Liferay’s Asset Framework. While you could map basic asset entry fields) in fragments, the content’s type and subtype specific fields (e.g., document, object, and web content fields) were not available.

Using Search Blueprints as Collection Providers

To use a search blueprint’s collection provider,

  1. For versions before Liferay DXP 2026.Q1, enable the release feature flag for LPS-129412.

  2. Create a blueprint. For Liferay DXP 2025.Q3+, you must toggle the Enable as a Collection Provider switch.

    You can also toggle this setting at any time from the blueprint’s configuration tab. See Enable Blueprint as a Collection Provider for more details.

  3. Define the searchable types in the blueprint’s Query Builder tab.

    You can choose types and subtypes in the blueprint's Query Builder.

  4. Save your blueprint.

  5. Add the Collection Display fragment to a content page and choose the blueprint’s collection provider in the Collection Providers field.

    You can also use the collection provider when adding collection pages.

  6. Map the fields from the blueprint response to your fragments.

    Map the fields from the blueprint response to your fragments.

As with other collections, you can filter the blueprint-driven collection by keywords or categories with a collection filter.

Example: Showing File Entries from a Custom Document Type

Create documents and media files and configure a blueprint to display the events on a content page using the collection display fragment:

  1. For versions before Liferay DXP 2026.Q1, enable the release feature flag for LPS-129412.

  2. Navigate to Product MenuContent & DataDocuments and MediaDocument Types.

  3. Click New and create a document type called Cat Photos with a Text field labeled Cat’s Name.

  4. Create a second document type called Dog Photos with a Text field labeled Dog’s Name.

    Create two document types.

    Note

    To use the custom fields of these document types in the blueprints collection display, you must select a single type (Document) and a single subtype (e.g., Cat Photos) as the blueprint’s searchable type. If you select a second subtype (e.g., Dog Photos), only the shared fields from the Document type are available.

  5. Navigate to Product MenuContent & DataDocuments and Media to upload files using your new document types.

  6. Click New and create one entry for each type.

    Feel free to customize the example values:

    • Type: Cat Photos
      • Title: Priscilla lounging dramatically
      • Cat’s Name: Priscilla Tenderpaws
      • File: Upload a photo
    • Type: Dog Photos
      • Title: Foofy on the couch
      • Dog’s Name: Foofy Hernandez
      • File: Upload a photo

    Add an entry for each document type.

  7. Navigate to Global Menu (Global Menu) → ApplicationsBlueprints.

  8. Create a new blueprint titled Pet Photos Blueprint and switch the Enable as a Collection Provider toggle to active.

  9. In the Query Builder tab under Source, choose the Selected Types option.

  10. Select Document as the asset type; then select Dog Photos and Cat Photos as the subtypes.

    Select both custom document types as the subtypes of Document.

  11. Save the blueprint.

  12. Create a new content page called Pets and add a Collection Display fragment.

  13. Select the Pet Photos Blueprint collection provider.

    Your blueprint collection provider is now on the page.

  14. Add a Heading fragment to the collection’s dropzone and click the text to open the mapping sidebar. Map the fragment to the Title field.

    Custom fields like Cat’s Name are hidden because multiple subtypes are selected.

    Map the title to the fragment.

  15. Add an Image fragment and map it to the document’s Preview Image field.

    Add an Image fragment and map it to the document's Preview Image field.

  16. Publish the page, and the collection shows both pets you added.

    Add your pet photos to the collection display.

To use a custom document type’s fields in the collection display, you must edit the blueprint, removing all but a single type/subtype pair (e.g., Document → Dog Photos). Then, reconfigure the collection display (you may need to start from scratch) and see that the custom fields are now available for mapping.

The single subtype's fields can be mapped in a collection display.

Example: Showing Future Events

Create calendar events and configure a blueprint to return only events that happen in the future. Display the events on a content page using the collection display fragment:

  1. For versions before Liferay DXP 2026.Q1, enable the release feature flag for LPS-129412.

  2. Add the Calendar widget to a page and create three events:

    • Past Event: Set the end time to 5–15 minutes from the current time.
    • Future Event 1: Set the start time to tomorrow.
    • Future Event 2: Set the start time to next week.

    Three events are added to the calendar widget.

  3. Navigate to Global Menu (Global Menu) → ApplicationsBlueprints.

  4. In the Elements tab, click New and create a new custom element called Limit Results to Future Events with this JSON:

    {
       "description_i18n": {
          "en_US": "Limit results to only future events, using the endTime field."
       },
       "elementDefinition": {
          "category": "filter",
          "configuration": {
             "queryConfiguration": {
                "queryEntries": [
                   {
                      "clauses": [
                         {
                            "context": "query",
                            "occur": "filter",
                            "query": {
                               "range": {
                                  "endTime": {
                                     "gt": "${time.current_date|date_format=timestamp}"
                                  }
                               }
                            }
                         }
                      ]
                   }
                ]
             }
          },
          "icon": "filter",
          "uiConfiguration": {}
       },
       "title_i18n": {
          "en_US": "Limit Results to Future Events."
       },
       "type": 0
    }
    
  5. Click Save.

  6. In the Blueprints tab, create a new blueprint titled Future Calendar Events Provider and switch the Enable as a Collection Provide toggle to active.

  7. In the Query Builder tab under Source, choose Selected Types and select Calendar Event as the asset type.

  8. In the Query Elements tab, add the Limit Results to Future Events element.

    Add the Limit Results to Future Events element in the Query Elements tab.

  9. Save the blueprint.

  10. Create a new content page called Upcoming Events and add a Collection Display fragment.

  11. Select the Future Calendar Events Provider collection provider.

    Configure the collection display fragment to show a bullet list.

  12. Add a Heading fragment to the collection’s dropzone and map it to the Title field.

  13. Publish the page.

    Only events with an endTime greater than the current date appear in the collection.

Only the future events are displayed in the collection display fragment.

Leverage blueprints to return your results dynamically, and reap the benefits of the fragments toolbox to lay out the page.