Thursday, 5 March 2009

EPiServer Search with VirtualPathVersioningProvider

EPiServer out of the box provides versioning file system handled by VirtualPathVersioningProvider. In this post I would like to show you step by step how to enable search for this provider.

Step 1 - Make sure that you are using VirtualPathVersioningProvider.

It sounds funny but it's worth double checking if your website is configured to use versioning file system or native file system (VirtualPathNativeProvider).

The best way is to check web.config section in which virtual providers are defined. You should find there lines like this:

   1:  <add showInFileManager="true" 
   2:       virtualName="Documents" 
   3:       virtualPath="~/Documents/" 
   4:       bypassAccessCheck="false" 
   5:       maxVersions="5" 
   6:       name="SiteDocuments"
   7:       type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer"
   8:       physicalPath="C:\EPiServer\VPP\ExampleEPiServerSite\Documents">

physicalPath property specifies where actually files will be stored. Interesting is that the paths and the filenames are stored in a database, only content is located in the file system. Internally, VirtualPathVersioningProvider keeps content in a fairly characteristic way:


Step 2 - EPiServer Indexing Service configuration


Indexing Service configuration is saved in a EPiServer.IndexingService.exe.config file which can be found in the same folder where the EPiServer Indexing Service was installed.

To let know indexing service about your folders you need to alter following part of configuration:

   1:  <episerver.indexingService>
   2:    <indexes>
   3:      <add connectionString="Data Source=server_name;Database=db_name;User Id=username;Password=password;Network Library=DBMSSOCN;" 
   4:           databaseClient="" 
   5:           filePath="C:\EPiServer\VPP\ExampleEPiServerSite\Documents" 
   6:           itemRoot="/Documents" />
   7:    </indexes>
   8:  </episerver.indexingService>

Two things are important here:
  • you need to use the same database here (connectionString) which your application is using
  • and the same path (filePath)

Step 3 - Make sure that Indexing Service works

The best way to makes sure that your folder was indexed is to check if folder called index was created. (Check the first image) This folder contains indexing service's data.

If your service is started and index folder is not present then probably good idea is to check indexing service logs, usually you can find there helpful information.

Lack of index folder can also cause error like this:

VirtualPathProvider 'SiteDocuments', Search Error: C:\EPiServer\VPP\ExampleEPiServerSite\Documents\index not a directory

Step 4 - Check if it works Probably the fastest way to check if search works it to use EPiServer's build-in file management tool:


Then you can access search feature:


I hope that this post will save a few people a bit of time. If you have been working with EPiServer search before and have interesting experiences then leave a comment, your input is valuable!

4 comments:

Anonymous said...

Any idea how to get the episerver file search to include sub folders?

Anonymous said...

Nice post!

I followed the steps give but still i am facing an error "VirtualPathProvider 'SiteDocuments', Search Error: C:\EPiServer\VPP\test\Documents\index not a directory"

Anonymous said...

could u help us?

Leif said...

Great post Marek! Solved my problems.