legacy-knowledge-base
公開されました Jun. 30, 2025

Dynamic Blueprint parameters with Search API

投稿者

Daniel Carrillo Broeder

knowledge-article-header-disclaimer-how-to

knowledge-article-header-disclaimer

legacy-article

learn-legacy-article-disclaimer-text

Issue

  • Blueprints offer static filtering by field values, but a dynamic approach is needed where search fields enable filtering based on user-provided values for specific structure fields, Is possible to provide custom parameters to Search Blueprints?
    • How can I create a search experience that allows filtering content from a specific structure based on the values of its fields, using a dedicated search input for each field?

Environment

  • Quarterly Releases 2024.Q3+

Resolution

Dynamic filtering by structure fields can be achieved using Blueprints and the Search headless API:

  1. Create the Blueprint:

    • Add a parameter in the Blueprint configuration, prefixed with search.experiences.* (e.g., search.experiences.fieldName). This parameter will hold the value entered by the user in the search input.
    • parameter_config.png
    • In the Query Builder, under "Paste Any Elasticsearch Query" or "JSON element", insert ${search.experiences.fieldName} in the code as a variable.
      • This integrates the parameter's value into the search query.
    • paste_any.png
    • Adjust "Query Settings" as needed to refine the search behavior.
    • Test the Blueprint by setting the variable directly within the Blueprint preview.
    • context_attrs.png
    • Configure and copy the External Reference Code (ERC) for API usage.
  2. Access the Search Headless API:

    • Enable the Release Feature Flag LPS-179669.
    • Use the postSearchPage endpoint of the Search headless API (ensure the feature flag is enabled). This endpoint allows executing searches based on Blueprints.
    • Include the parameter nestedFields=embedded to retrieve embedded objects (content). This ensures that the structure's fields are included in the search results.
    • In the request body, provide a JSON structure containing the variable with the value to filter by (e.g., {"fieldName": "your_value"}). Replace fieldName with the actual name you used in the Blueprint configuration and your_value with the desired filter value.
    • The API response will return search results filtered based on your provided parameter.
    • apisearch.png

Alternative Approaches:

  1. Headless Delivery API for Web Content Filtering: Explore the headless APIs specifically designed for filtering web content by structure fields, like headless delivery API.

  2. Nested Custom Filters: Consider using nested Custom Filters for a more integrated approach to filtering within the search interface.

  3. Custom Facets: Utilize Custom Facets to provide users with interactive filtering options based on structure field values.

Additional Information

did-this-article-resolve-your-issue

legacy-knowledge-base