Configuring Full-Text Search for Files Stored in File System or in Microsoft SQL Database

The samples provided with SDK as well as code generated by WebDAV wizards for Visual Studio use Windows full-text search (in case of file system storage) or Microsoft SQL Server full-text search (in case of Microsoft SQL storage) to provide search results.

The server implementation searches both file names and file content including content of Microsoft Office documents as well as any other documents that provided IFilter plugin implementation in Windows OS, such as LibreOffice, OpenOffice, Adobe Reader, etc.

Searching Microsoft Office Documents Content

To index Microsoft Office documents content (.docx, .pptx, .xlsx files) you must install the Microsoft Office 2010 Filter Packs and Service Pack 2 for Microsoft Office 2010 Filter Pack 64-Bit Edition or Service Pack 2 for Microsoft Office 2010 Filter Pack 32-Bit Edition.

Enabling Full-Text Search for Files Stored in File System

  1. Install the Windows Search Service. In most cases, for example on Windows 7 and Vista, the search service is installed by default on your machine. In some cases, however, for example on Windows Server 2008 Web edition it is not installed. In this case you must enable it via Add Roles And Features Windows wizard.

    In case of Windows Server 2003, you must download and install the Windows Search 4.0 for Windows Server 2003 manually.

  2. Install the Microsoft Office 2010 Filter Packs and a service pack as described at the beginning of this article.

  3. Enable full-text indexing on the folder where your documents are located (usually \App_Data\WebDav\Storage\ folder) as described here.

Enabling Full-Text Search for Files Stored in Microsoft SQL Database

Important! The full-text search is not supported on Microsoft SQL Server LocalDB and Express editions. You will need at least Microsoft SQL Standard edition or higher to use full-text search.

The full-text search is not supported in Microsoft SQL Server LocalDB and Express editions. Because of this limitation, to provide maximum compatibility, the code that enables full-text indexing and search is commented out in both SQL script that creates the database and in C# code that are provided with samples or generated by the WebDAV Wizard for Visual Studio. As a result, by default, you will be able to search file names only. To search file content follow this steps to enable full-text indexing and search:

  1. Install the Microsoft Office 2010 Filter Packs and a service pack as described at the beginning of this article on the Microsoft SQL Server machine.

  2. Create a full-text catalog in your database, executing the commands found at the end of DB.sql generated by WebDAV Wizard for Visual Studio or provided with a sample:

    CREATE FULLTEXT CATALOG FileCatalog AS DEFAULT; 
    GO 
    CREATE FULLTEXT INDEX ON [WebDav].[dbo].[Item] 
    ([Content] TYPE COLUMN [Name]) 
    KEY INDEX [PK_Item] 
    ON FileCatalog 
    WITH CHANGE_TRACKING AUTO; 
    GO
  3. Uncomment the code in Search method implementation in DavFolder.cs, this will enable file content search. Rebuild your project.

 

See also: