Search query examples | HCL Digital Experience
These are examples of search queries you can create by using an HTML element.
The query parameters can be set in the request parameters. For
instance, a search component that is displayed on a page whose URL
contained a search query ?search_query=shoes
displays
search results for shoes.
Simple search query
Code example | Description |
---|---|
|
This is the form header where you specify the
location of the content item containing the search element that is
used to display the search result. This is typically the same content item that this HTML element is stored in. |
|
This is the body of the search form. Like any
standard HTML form, it contains an input field and a submit button. In this example, a table has been used to format the search query form. |
|
This closes the form. |
Searching metadata
Code example | Description |
---|---|
|
This is the form header where you specify the
location of the content item containing the search element that is
used to display the search result. This is typically the same content item that this HTML element is stored in. |
|
This is the body of the search form. Like any standard HTML form, it contains input fields and a submit button. |
|
This closes the form. |
Including hidden data
Code examples | Description |
---|---|
|
This is the form header where you specify the
location of the content item containing the search element used to
display the search result. This is typically the same content item that this HTML element is stored in. |
|
Here a hidden input field has been added that searches for content that use the authoring template called "Press Release". |
|
This is the body of the search form. Like any standard HTML form, it contains input fields and a submit button. |
|
This tag closes the form. |
Setting the search query in the request attributes
The
query parameters can also be set in the request attributes on the
server. For instance, a search component that is displayed after the
following tag is used: [Plugin:RequestAttribute
key="search_query" value="shoes" compute="once"]
displays
search results for shoes.