<search:query>
) instantiates a search query that can be submitted to the underlying search platform.
http://intranet/search?q=guidelines&rpp=10
, then the word ‘guidelines’ would be set as the query term, and the query would instruct the search engine to limit the results per page (rpp) to 10.
This example shows how you can override the rpp
(short form of the results-per-page
attribute) to fix how many results should be displayed per page, or override the value specified in the URL query string. To do this, add the long-form name of the attribute to override to the Query tag:
{{myQuery}}
.
You can also create a Query instance from another one using the from attribute for cloning the former:
var (java.lang.String)
This is the name of the variable in which the query object will be stored.query
parameters (java.lang.String)
Parameters to use from the HTTP request to create the Query object. Set parameters
to *
to use all parameters. A comma-separated list of parameters to use is also valid.
from (twigkit.model.Query)
Create a new Query from existing Query object.
query (&q=) (java.lang.String)
Use the query (or q) parameter to specify the query term to use. This will override default-query parameter of the Platform.
modified-query (&mq=) (java.lang.String)
Specify an alternative query that will be submitted to the search engine in place of the query parameter supplied by the user (but can include user submitted parameter). To the user it will appear as the query parameter had been used, but the modified-query will be 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), all (boolean OR/AND the terms), or adv (interpret using search platform-specific advanced query language). For example, take the query apple ipod. With type=“all” documents containing both the terms (for example, apple and ipod) will be returned, whereas with type=“any” documents containing either term (for example, apple or ipod) will be returned. See special cases section below for type=“adv” usage examples.any
results-per-page (&rpp=) (java.lang.Integer)
The number of results to display per page.max-results (&max=) (java.lang.Integer)
The maximum number of results to evaluate.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 comma-separated list without spaces (for example, facets=“cat,inStock”). Will override defaultFacets parameter of the Platform tag.
fields (&fi=) (java.lang.String)
A comma-separated list of fields that 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 and - for descending. To sort ascending by the field price, the sort would be specified as sorts="+price"
.
Multilevel sorting is supported. To sort by multiple levels using the QueryTag 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, for example, ?&s=+price&s=-sku
.
view (&v=) (java.lang.String)
Set which search engine view to use. Behavior will vary by installation.
filters (&f=) (java.lang.String)
Specifies filters to apply, specified as an ampersand (&) separated String. In the query string however there will be multiple &f=
arguments. Filters are used to restrict field values in that appear in results. Also see Alternative way to add Filters below.
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 lets you send custom parameters to the underlying search platform. Parameters are specified using the format parameter[value]
for a single parameter and corresponding value. Multiple parameters can be submitted with the QueryTag by separating them with & characters. For example:
custom="parameter1[value1]¶meter2[value2]"
c
parameter. For example:?c=parameter1[value1]&c=parameter2[value2]
fieldName[value]['display name']
. The ['display name']
part is optional in all cases.
For example, adding filters="locations['san francisco']"
to the Query tag restricts the results to those with san francisco
appearing in the locations field.
Multiple filters can be specified on the Query tag by using the separator characters &. For example, filter="locations['san francisco']&people['obama']"
would restrict the results to those with the value san francisco
appearing in the locations field and the value obama
appearing the people field.
Multiple filters can be specified with the URL query string by adding multiple f parameters:
&f=stringField['My String']["String example"]
&f=integerField[123]["Integer example"]
&f=doubleOrFloatField[123.45]["Double example"]
filters="fieldName[value]["display name"]
.
filters=salary[1000,100000]
will search the salary field for values between 1000 and 100000.
filters=dateFieldName[,yyyy-MM-dd’T’HH:mm:ss]["Before the given date"]
filters=dateFieldName[yyyy-MM-dd’T’HH:mm:ss,]["After the given date"]
filters=dateFieldName[yyyy-MM-dd’T’HH:mm:ss,yyyy-MM-dd’T’HH:mm:ss]["Date range"]
[
and ]
with a (
and )
. For example: filters=dateFieldName[yyyy-MM-dd’T’HH:mm:ss,yyyy-MM-dd’T’HH:mm:ss)["Date range excluding upper limit"]
<query:filter>
tag. The value will always be interpreted as a string.
See the query:filter
tag doc for available parameters.
(foo:bar AND (marx:groucho OR marx:harpo))
'field'
flag. This would mean that these filters are combined with the rest using an OR
.
This is encoded in the query URL using a tilde before the field name:
foo:bar) OR (marx:groucho) OR (marx:harpo
bestbets
field should be true:
query:filter
tag and the query:custom
tag in the body of a search:query
tag to add invariant query filters or custom engine parameters, respectively.