Work with triggers and query templates

If a specific site is not crawled by Microsoft Search Server 2008 server directly, you can add it as a federated location and include its search results for users of the Search Center site. When you add a federated location, you must specify the query template that is used for query URL of the federated location. Optionally, you can also specify one or more query constraints, known as triggers, to restrict the queries that are passed to the federated location.

In this topic you'll learn more about specifying triggers, along with how to construct the query template for a federated location.


A trigger is a query constraint that determines when a query is passed. When you create a federated location you can specify triggers that determine when a query is passed to it. Only queries that match the pattern specified for the triggers in the location definition are forwarded to the federated location.

There are two types of triggers:

  • Prefix The query must be prefixed with the exact term that is specified in the trigger. For example, if "weather" is specified as the prefix trigger, then the query "weather New York, NY" is forwarded but "New York, NY" is not forwarded.

    Note: Only the portion of the query that follows the prefix is forwarded; in the example "weather New York, NY", only "New York, NY" is forwarded to the federated location.

  • Regex The query must match the specified regular expression pattern. For more information about creating regular expressions, see .NET Framework Regular Expressions.

Query templates

The query template contains the parameterized URL for the federated location, and search queries are passed to this URL. The parameterized URL must return structured XML results (for example, RSS or Atom results).

Search Server 2008 supports two types of federated locations:

  • Search Index on this Server
    The query template for the Search Index on this Server federated location type should contain the searchTerms parameter that you specify as follows:


It should also contain any additional query restrictions, such as a search for content from a specific author, as shown in the following example:


The query template for this federated location type should not include the search results URL.

  • OpenSe arch
    Any Internet site that supports the OpenSearch standard.

The query template is equivalent to the URL template in the OpenSearch specification, and the syntax is based on the URL template syntax. Following is a simple example of a location query template that contains a parameterized URL to connect to the Live Search service:{searchTerms}&format=rss

In this example, the query template contains the OpenSearch template parameter searchTerms. The searchTerms parameter is a placeholder for the search words that are forwarded to the federated location. You can specify additional parameters in the query template. For more information about these parameters, see the OpenSearch 1.1 parameters section in the OpenSearch specification.

You can indicate whether a parameter is optional by including a question mark character (?) after the parameter name. In the following example, the searchTerms parameter is required, but the startIndex parameter is not:{searchTerms}&format=rss&first={startIndex?}

Note: Parameters that you specify in the URL template must be URL-encoded. In the previous example, the ampersand character (&) is replaced with the URL encoding for this character, "&".

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!