Skip to main content

predictive_search

Information about the results from a predictive search query through the Predictive Search API.


Note

The predictive_search object returns results only when rendered in a section using the Predictive Search API and the Section Rendering API. To learn about how to include predictive search in your theme, refer to Add predictive search to your theme.


Properties

Returns true when being referenced inside a section that's been rendered using the Predictive Search API and the Section Rendering API. Returns false if not.

The resources associated with the query.

You can check whether any resources of a specific type were returned using the size filter.

{% if predictive_search.resources.articles.size > 0 %}
{% for article in predictive_search.resources.articles %}
{{ article.title }}
{% endfor %}
{% endif %}

The entered search terms.

Tip

Use the highlight filter to highlight the search terms in search results content.

Anchor to
types
array of string

The object types that the search was performed on.

Searches can be performed on the following object types:

Note

The types are determined by the type query parameter.

{
"performed": true,
"resources": {},
"terms": "potion",
"types": []
}
Was this section helpful?