Skip to content

Allow accessing supplemental data from search tag #1339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
daun opened this issue May 14, 2025 · 0 comments
Open

Allow accessing supplemental data from search tag #1339

daun opened this issue May 14, 2025 · 0 comments

Comments

@daun
Copy link

daun commented May 14, 2025

  • 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 }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant