Home > Lucene Search > Step 3: Create a File Crawler Config File

Step 3: Create a File Crawler Config File

Include the App_Config\Include folder in the project and create a new file called FileCrawler.config. This is an include file that integrates the crawler and UI handler with the Sitecore.Search framework. Copy and paste the content below into the FileCrawler.config file:

FileCrawler.config

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <processors>
      <uiLaunchSearchResult>
        <processor type="FileCrawler.FileSystem.LaunchResult,FileCrawler" patch:before="*[1]"/>
      </uiLaunchSearchResult>
    </processors>
    <search>
      <configuration>
        <indexes>
          <index id="system">
            <locations>
              <filesystem type="FileCrawler.FileSystem.Crawler, FileCrawler">
                <Root>/</Root>
                <Tags>filesystem</Tags>
                <Boost>0.5</Boost>
              </filesystem>
            </locations>
          </index>
        </indexes>
      </configuration>
    </search>
  </sitecore>
</configuration>

LaunchResult processor is integrated into uiLaunchSearchResult pipeline which handles user requests to open a search result:

<uiLaunchSearchResult>
        <processor type="FileCrawler.FileSystem.LaunchResult,FileCrawler" patch:before="*[1]"/>
      </uiLaunchSearchResult>

The new FileSystem.Crawler is added as a location to the system index. The system index is used by Sitecore Quick Search:

          <index id="system">
            <locations>
              <filesystem type="FileCrawler.FileSystem.Crawler, FileCrawler">
                <Root>/</Root>
                <Tags>filesystem</Tags>
                <Boost>0.5</Boost>
              </filesystem>
            </locations>
          </index>

Root specifies the root folder of the Web site which is the starting point for the crawler.

                <Root>/</Root>

Tags are words or text that can be associated with search results. When performing a search they enable you to return results with a specific tag by appending +_tags:tagname to the search query. The current Sitecore UI does not support tags. However, when implementing a Web site search or other custom search UI it is possible to include support for tags.

                   <Tags>filesystem</Tags>

Enter a value in Boost to adjust the priority of files compared to other search results in Sitecore, such as items, control panel options, or applications. A value of 0.5 gives a usable list of search results.

                <Boost>0.5</Boost>

Rules for Boost:

  • Value must be greater than zero.
  • Default value for Boost is 1.0
  • Values greater than 1.0 push the results to the top.
  • Values less than 1.0 drag the results to the bottom (this is not often used).

Step 4: Test the Sitecore.Search File Crawler

Categories: Lucene Search Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.