Search Queries

The search:query tag instantiates a search query that can be submitted to Fusion. The search:query tag can use all applicable parameters from the query string (HTTP request) to create a query object. Queries can also include filters.

Usage example

As an example, imagine the URL of the page looks like this:


In this example, guidelines is the query term, and the resultsPerPage attribute (rpp) is limited to 10.

You can override the rpp to fix how many results should be displayed per page, or override the value specified in the URL query string. To do this, append the search:query tag with the long-form name of the attribute you want to override:

<search:query var="query" parameters="*" resultsPerPage="5" />

You can also clone a query instance using the from attribute:

<search:query var="query" from="${otherQuery}" resultsPerPage="5" />

Query Parameters

Parameter Description Default

var (java.lang.String)

This is the name of the variable into which the query object is stored.


parameters (java.lang.String)

Setting parameters to "*" means that all parameters from HTTP request is used to create a query object. Comma-separated list of parameters to use is also valid.

from (twigkit.model.Query)

Create a new query from existing query object.

For the parameters below, parameters in the URL override parameters in the search:query tag. To ignore URL parameters and always use the parameter in the tag, exclude the URL parameters by negating them with a hyphen (-) in the parameters attribute. For example, to ignore any occurrences of rpp in URLs, use -rpp, like this: <search:query parameters='*,-rpp' rpp=5>

query (&q=) (java.lang.String)

Use the query (or q) parameter to specify the query term to use. This overrides the defaultQuery parameter of the search:platform tag.

modifiedQuery (&mq=) (java.lang.String)

Specify an alternative query which is submitted to the search engine in place of the query parameter supplied by the user (but can include user-submitted parameters). To the user it appears as if the query parameter had been used, but the modifiedQuery is submitted to the search engine.

type (&t=) (java.lang.String)

Specifies how to interpret multiple query terms. Takes one of three values:

  • any (boolean OR the terms)

    For example, take the query "apple ipod". With type=“all” documents containing both the terms (apple AND ipod) is returned.

  • all (boolean OR/AND the terms)

    Documents containing either term (apple OR ipod) are returned.

  • adv (interpret using search platform-specific advanced query language)


resultsPerPage (&rpp=) (java.lang.Integer)

The number of results to display per page.


maxResults (&max=) (java.lang.Integer)

The maximum number of results to evaluate. Defaults to -1 which means no upper limit.


page (&p=) (java.lang.Integer)

Set the page of results to display. Default values is 1 (1-based index) which would display the first page of results (1 to getResultsPerPage).


facets (&fa=) (java.lang.String)

Specifies which facets to evaluate and return. Specified as a comma-separated list without spaces (such as facets=“cat,inStock”). This overrides the defaultFacets parameter of the search:platform tag.

fields (&fi=) (java.lang.String)

A comma-separated list of fields which should be returned in the response.

sorts (&s=) (java.lang.String)

Specifies fields and order for sorting. Sort order is specified by one of two characters:

  • + for ascending

  • - for descending

To sort ascending by the field price, the sort is specified as sorts=“+price”. Multilevel sorting is supported. To sort by multiple levels using the search:query tag, use & to separate the values. For example, to sort by price ascending and then SKU descending, use sorts=“+price&-sku”. To do the same using the URL query string, use multiple instances of the s parameter, such as ?&s=+price&s=-sku.

view (&v=) (java.lang.String)

Set which search engine view to use.

filters (&f=) (java.lang.String)

Specifies filters to apply, specified as an ampersand (&) separated string. In the query string, however, there are multiple &f= arguments. Filters are used to restrict field values in that appear in results.

facetsEnabled (java.lang.Boolean)

Whether to calculate and return facets for the query. Behavior is platform dependent.

custom (&c=) (java.lang.String)

The custom attribute allows you to send custom parameters to the search platform. Parameters are specified using the format parameter[value] for a single parameter and corresponding value. Multiple parameters can be submitted with the search:query tag by separating them with & characters, as in custom=“parameter1[value1]&parameter2[value2]“. To submit multiple custom parameters using the URL query string, use multiple instances of the c parameter, such as ?c=parameter1[value1]&c=parameter2[value2].