<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)
query
parameters (java.lang.String)
parameters
to *
to use all parameters. A comma-separated list of parameters to use is also valid.
from (twigkit.model.Query)
query (&q=) (java.lang.String)
modified-query (&mq=) (java.lang.String)
type (&t=) (java.lang.String)
any
results-per-page (&rpp=) (java.lang.Integer)
max-results (&max=) (java.lang.Integer)
page (&p=) (java.lang.Integer)
facets (&fa=) (java.lang.String)
fields (&fi=) (java.lang.String)
sorts (&s=) (java.lang.String)
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)
filters (&f=) (java.lang.String)
&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)
custom (&c=) (java.lang.String)
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.