Skip to content

Index Definition

Dmitry Harnitski edited this page Nov 30, 2016 · 3 revisions

Algolia Index Definition

AlgoliaSearchIndex inherits configuration from Sitecore.ContentSearch.AbstractSearchIndex.

Additional configuration added:

  • applicationId - Algolia Application ID
  • fullApiKey - Algolia Api Key. This key should have permissions for Index management and should be secured. Do not use this key for search operations from UI.
  • indexName - Algolia index name. Index will be created automatically if it does not exist.
  • site - site name as it is defines in Sitecore config sections. If site is defined, fields can generate site specific content like full url to page.

Sample

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
        <indexes hint="list:AddIndex">
          <index id="algolia_test" type="Score.ContentSearch.Algolia.AlgoliaSearchIndex, Score.ContentSearch.Algolia">
            <param desc="name">$(id)</param>
            <param desc="applicationId">4U4JZCMJO2</param>
            <param desc="fullApiKey">b9c172c5c52d094286825f8fbe2d2d7d</param>
            <param desc="indexName">algolia-test</param>
            <Site>website</Site>
            <configuration ref="contentSearch/indexConfigurations/testAlgoliaIndexConfiguration" />
            <strategies hint="list:AddStrategy">
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster" />
            </strategies>
            <locations hint="list:AddCrawler">
              <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
                <Database>master</Database>
                <Root>/sitecore/content/Home</Root>
              </crawler>
            </locations>
            <propertyStore ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)">
            </propertyStore>
          </index>
        </indexes>
      </configuration>
    </contentSearch>
  </sitecore>
</configuration>

Algolia Crawler

Custom Configuration:

  • ShowInSearchResultsFieldName - field name that defines if item should be added to the index. No value in that field excludes item from index. This configuration extends standard sitecore features - Root and Templates list. By default all Items are indexed.

Sample

<locations hint="list:AddCrawler">
   <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
       <Database>master</Database>
       <Root>/sitecore/content/Home</Root>
       <ShowInSearchResultsFieldName>Show In Search Results</ShowInSearchResultsFieldName>
    </crawler>
</locations>
Clone this wiki locally