Export (0) Print
Expand All

Work with triggers and query templates (Office SharePoint Server)

SharePoint 2007

Applies To: Office SharePoint Server 2007

 

Topic Last Modified: 2008-07-25

If a specific site is not crawled by Microsoft Office SharePoint Server 2007 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 the 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 and 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 as the trigger. For example, if “weather” is specified as the prefix trigger, for the query “weather New York, NY” the prefix is dropped and only “New York, NY” is forwarded.”

    NoteNote:
    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 (http://go.microsoft.com/fwlink/?LinkId=117945).

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).

Office SharePoint Server 2007 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: {searchTerms}

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

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

  • OpenSearch

    Any Internet site that supports the OpenSearch standard

The query template is equivalent to the URL template in the OpenSearch Specification (http://go.microsoft.com/fwlink/?LinkId=111090). The syntax is based on the URL template syntax (http://go.microsoft.com/fwlink/?LinkId=100718). Following is a simple example of a location query template that contains a parameterized URL to connect to the Live Search service: http://search.live.com/results.aspx?q={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 (http://go.microsoft.com/fwlink/?LinkId=100720) 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: http://search.live.com/results.aspx?q={searchTerms}&format=rss&first={startIndex?}

NoteNote:
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, "&".

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft