+

Search Tips   |   Advanced Search


Search query examples

These are examples of search queries you can create using an HTML element.


Simple search query

This is an example of a simple search query form:


Table 1. Simple search query

Code example Description

<form  action='<PathCmpnt type="servlet" />/library/site/ sitearea/content' method="post">
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 usually the same content item that this HTML element is stored in.

<table>
    <tr><td>
        <input type="text" name="search_query"/>
    </td></tr>
    <tr><td align="right">
        <input type="submit" value="Search"/>
    </td></tr>
</table>
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.

</form>
This closes the form.


Search metadata

In this example, two more fields have been added allowing users to search both content title and author name:


Table 2. Searching metadata

Code example Description

<form  action='<PathCmpnt type="servlet" />/library/site/ sitearea/content' method="post">
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 usually the same content item that this HTML element is stored in.

<table>
    <tr>
        <td>Content Title</td>
        <td><input type="text" name="search_title"/></td>
    </tr>
    <tr>
        <td>Author's Name</td>
        <td><input type="text" name="search_authors"/></td>
    </tr>
    <tr>
        <td>Content Body</td>
        <td>
        <input type="text" name="search_query"/>
    </td></tr>
        <tr><td align="right">
        <input type="submit" value="Search"/>
    </td></tr>
</table>
This is the body of the search form. Like any standard HTML form it contains input fields and a submit button.

See below for a list of search parameter names.

</form>
This closes the form.


Include hidden data

In this example, a hidden field has been added to restrict the search to content that use the authoring template called "Press Release":


Table 3. Including hidden data

Code examples Description

<form  action='<PathCmpnt type="servlet" />/library/site/ sitearea/content' method="post">
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 usually the same content item that this HTML element is stored in.

<input type="hidden"
       name="search_authoringtemplate"
       value="Press Release"/>
Here a hidden input field has been added that searches for content that use the authoring template called "Press Release".

<table>
    <tr>
        <td>Content Title</td>
        <td><input type="text" name="search_title"/></td>
    </tr>
    <tr>
        <td>Author's Name</td>
        <td><input type="text" name="search_authors"/></td>
    </tr>
    <tr>
        <td>Content Body</td>
        <td>
        <input type="text" name="search_query"/>
    </td></tr>
    <tr><td align="right">
        <input type="submit" value="Search"/>
    </td></tr>
</table>
This is the body of the search form. Like any standard HTML form it contains input fields and a submit button.

</form>
This closes the form.


Parent topic:

Creating a search query