Readme_Item Finder Sample

11/05/2008 21:36:06


This sample works only with SQL Server 2005 and SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2005.
The ItemFinder sample demonstrates how to implement search capabilities in database applications. By using the AdventureWorks sample database and the Full-Text Search capabilities of SQL Server, ItemFinder enables users to search through resumes and product descriptions stored as XML. They can also search documents stored as binary large objects (BLOBs). This sample application demonstrates:
  • Advanced techniques, such as paging and caching.
  • New features in Full-Text Search, such as enhanced multilingual capabilities and the implementation of XML data type. Default location: C:\Program Files\Microsoft SQL Server\100\Samples\Engine\Full Text Search

Languages

Transact-SQL

Features

Prerequisites

Before running this sample, make sure that the following software is installed:
  • SQL Server
  • AdventureWorks database that is available at the Microsoft.

Building the Sample

If you have not already created a strong name key file, generate the key file using the following instructions.
To generate a strong name key file
  1. Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.-- or --Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.
  2. Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed. Note: To determine the folder where samples are located, click the Start* button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.*
  3. At the command prompt, run the following command to generate the key file: sn -k SampleKey.snk Important: For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.
To build the sample, in SQL Server Management Studio, load and execute the Scripts\install.sql script to set up full-text indexes and create the following stored procedures:
  • usp_SearchResumes
  • usp_SearchProducts
  • usp_SearchDocuments
  • usp_AddDocument Build the application by using Microsoft Visual Studio 2005 or type the following in a .NET Framework command Prompt window:
msbuild /nologo /verbosity:quiet /property:Configuration=Debug CS\ItemFinder.sln

Running the Sample

To run the sample, run bin\Release\ItemFinder.exe (or bin\Debug\ItemFinder.exe).

Comments

The ItemFinder sample application provides a user interface that enables you to search resumes, product descriptions, and documents. You will also be able to use the sample to add documents to the Document table.
Sample data is available in many languages and formats. Through a set of drop-down lists, you can select the following:
  • A library (resumes, products, or documents).
  • A language (any language supported by Full-Text Search).
  • The maximum number of results.
  • The search type (CONTAINS or FREETEXT). Use ItemFinder for the following tasks.
Choose a search condition
Enter the search condition in the text box, and click Go to execute the query.
If you select the search type CONTAINS, ItemFinder uses the containssearchcondition syntax. For example, you can search for "rear reflector" using the proximity operator NEAR by typing in the text box: "rear" NEAR "reflector". Whatever the containssearchcondition you use, make sure that the search text you type is enclosed in double quotation marks ("search text"). For more information, see CONTAINS (Transact-SQL).
Similarly, if you select the search type FREETEXT, ItemFinder uses the freetextsearchcondition syntax. For example, if you use the "rear reflector" search condition, type into the text box: rear reflector. However, unlike CONTAINS, you do not enclose the search text in double quotation marks. For more information, see FREETEXT (Transact-SQL).
Browse large search results
If the search results cannot fit a single page of the ListView element, only the first page of results is displayed. A simple, efficient in-memory cache stores the key and rank values that matched the search criteria and any data that has already been retrieved.
To scroll back and forth through the pages of results, use the Last and Next buttons.
To clear the cache, click Clear Results, perform a new search, or close the application.
Change the host name of the database server
The host name of the database server that will be used is stored in the App.config file.
To change the host name:
  1. Click Edit, and then click Database Settings.
  2. Edit the App.config file directly.
Add supported document types to the Document table
To add document types, click File, and then click Add New File.
In addition, you can use the Add New File menu for the following tasks:
  • Specify a name for a file.
  • Place a file in the file system.
  • Specify the file type.
  • Store a short description of the file.
Get help on the sample
To obtain information about the sample, click the Help menu and select About.

See Also

Other Resources
Full-Text Search Enhancements CREATE FULLTEXT CATALOG (Transact-SQL) ALTER FULLTEXT CATALOG (Transact-SQL) DROP FULLTEXT CATALOG (Transact-SQL) CREATE FULLTEXT INDEX (Transact-SQL) ALTER FULLTEXT INDEX (Transact-SQL) DROP FULLTEXT INDEX (Transact-SQL) CONTAINS (Transact-SQL) CONTAINSTABLE (Transact-SQL) FREETEXT (Transact-SQL) FREETEXTTABLE (Transact-SQL)
Help and Information
  • Getting SQL Server 2008 Assistance* © 2008 Microsoft Corporation. All rights reserved.

Last edited Nov 6, 2008 at 10:31 PM by bonniefe, version 9

Comments

No comments yet.