ideas icon indicating copy to clipboard operation
ideas copied to clipboard

Allow accessing supplemental data from search tag

Open daun opened this issue 7 months ago • 0 comments

  • Currently, the search:results tag goes straight into looping over the results
  • However, it would make sense to split things into 1) general search result data and 2) the actual result array
  • Example: display search facets (like available sizes or distribution across categories) above results, then loop over results

Current

{{ search:results }}
    {{# No way to show distributions and facets :( #}}
    <a href="{{ url }}" class="result">
      <h2>{{ title }}</h2>
      <p>{{ content | truncate:240 }}</p>
    </a>
{{ /search:results }}

Suggested

Assuming a product search using a driver that provides facets:

{{ search }}
  {{ facets }}
    Sizes: {{ size:min }}—{{ size:max }}
  {{ /facets }}
  {{ results }}
    <a href="{{ url }}" class="result">
      <h2>{{ title }}</h2>
      <p>Size {{ size }}</p>
    </a>
  {{ /results }}
{{ /search }}

daun avatar May 14 '25 20:05 daun