From Spiffy Stores Knowledge Base

This template is rendered to display the results of a search.

If you do not provide a search.liquid template in your theme, a default system template will be used instead.

<div id="searchresults">
  <form action="/search" method="get">
      <input type="text" name="q" value="{{ search.terms | escape }}" id="q">
      <input type="submit" value="Search" style="width:100px">
  </form>{% if search.results_count == 0 %}{% if search.terms.size > 0 %}
  <p>Your search for "{{ search.terms | escape }}" did not yield any results</p>{% endif %}{% else %}
  <ol>{% for hit in search.results %}
      <h3>{{ hit.title | link_to: hit.url, hit.title }}</h3>{% if hit.images_count > 0 %}
      <div class="result-image">
        {{ hit.featured_image | img_url: 'thumb' | img_tag: hit.title | link_to: hit.url, hit.title }}
      </div>{% endif %}
      <span><small>{{ hit.content | strip_html | truncate: 450 }}</small></span>
      <div style="clear:left"></div>
    </li>{% endfor %}
  </ol>{% endif %}

Each item in the search results can be either a Product, Collection, Page, Article or Blog. You can retrieve the type of object as follows:

item.object_type => 'product'

The following object types are returned:

  • product
  • collection
  • page
  • article
  • blog


In search.liquid you have access to the following variables:

Further Reference