Working with the Sample

Reading the Sample

Data provided to the Web Part include the URL to the workspace in which the Web Part is stored, and the URN of a document property used in the query. The Web Part will perform queries against documents published in this workspace. The property URN provided must have a system or user dictionary entry in the workspace where this part is installed. The part retrieves the dictionary values for that property.

The query is composed by the client-side JavaScript component. The properties that are selected are those expected by the Search Results Web Part on the dashboard site. If you do not select a property, the corresponding field for that property is not displayed on the Search Results Web Part. For example, if you do not select "DAV:getlastmodified", the Search Result Web Part will leave this field blank when displaying the results from your query.

The WHERE clause for the query is constructed based on user input in the fields provided by the Web Part. The WHERE clause checks the value of the Uniform Resource Identifier (URI) property against the string value supplied by the user if the query is performed against document properties. If the query is performed against a keyword, the scope of the WHERE clause changes to include the FREETEXT predicate so that keywords in document content classes are included in the query. For more detailed information about composing search queries, see SharePoint Portal Server Search SQL Syntax.

The Web Part submits the query to the SharePoint Portal Server Search engine by using the Hypertext Transfer Protocol (HTTP) post method. The results are posted to the Search Results Web Part on the dashboard site.

Running the Sample

To run this sample, you must complete the following two procedures:

  • Importing the Web Part
  • Configuring the Web Part

To import the Web Part:

  1. As a coordinator, open the dashboard site for your workspace.

  2. Click Content.

  3. Under Import or Create, click Import a Web Part File.

  4. In the Select Web Part file to import dialog box, browse to the location of the Web Part on your computer, <sdk_root>\Samples\SPS\Search\DWP. Select "SearchDict.dwp" and click Open.

    The Web Part that you imported appears as "Search Web Part with Dictionary Lookup" in the Web Parts list.

To configure the Web Part:

  1. Click Search Web Part with Dictionary Lookup to view advanced settings for the Web Part.
  2. Click Show Advanced Settings.
  3. Select the Store the following data for this Web Part check box.
  4. In the text box, type the full path to the workspace. For example, http://<My_Server>/<My_Workspace>.
  5. On the second line, type the Uniform Resource Name (URN) to a property with a dictionary value. For this Web Part use the Categories property: urn:schemas-microsoft-com:publishing:Categories. Please note that the URN is case sensitive.
  6. To commit the changes to the Advanced Settings for the Web Part, click Save.
  7. To save the Web Part and new settings to the dashboard site, click Save.
Verifying the Sample

The Web Part should appear on the dashboard site. Type a keyword in the text box and select a category from the drop-down list and click Go to submit a query.