Update lucene search index in sitecore

379 views Asked by At

I have defined lucene search index in sitecore 7.2 initial release. it's working fine but it did not updates itself on publish. although i have defined index updated both "OnPublishEndAsynchronousStrategy" & "RebuildAfterFullPublishStrategy" strategy as below.

<strategies hint="list:AddStrategy">
       <strategy ref="contentSearch/indexUpdateStrategies/onPublishEndAsync" />
</strategies>

but it did not updates on publish a single item in smart publish.

I also have an alternative to rebuild index on publish from code

Sitecore.ContentSearch.ContentSearchManager.GetIndex("SearchIndexName").Rebuild();

but it's seems not a proper / efficient way to this.

Configuration code for reference:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
        <indexes hint="list:AddIndex">
          <index id="my_sitesearch_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
            <param desc="name">$(id)</param>
            <param desc="folder">$(id)</param>
            <param desc="propertyStore" ref="contentSearch/databasePropertyStore" param1="$(id)" />

            <configuration ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration">
              <indexAllFields>true</indexAllFields>

              <include hint="list:IncludeTemplate">
                <cmb>{FBAC6C1C-0B59-401A-B01A-8B7435EFA6A6}</cmb>
                <home>{4291EDE0-8A5E-4B2E-A08F-D1299B262181}</home>
                <category>{0D2CB285-CD2F-4813-A8F8-59E18507CD60}</category>
                <externalLink>{77AD69A5-9F82-4955-B678-140EE6C8D5D8}</externalLink>

                <fullwidthmap>{EFC1AD32-1495-46D8-B7BD-875B40D23CDE}</fullwidthmap>
                <newsdetail>{BE9BD444-A1B7-43F0-98B1-61AF9A4CD83C}</newsdetail>
                <product>{45E6DFFD-481E-40D4-923B-D5FD903EE44B}</product>
                <productListing>{16E3C0EC-A5D7-49F3-B18E-AA0434DEAD3F}</productListing>
                <segment>{99F070CF-7D8C-4F76-91B1-5B165DB7D7B4}</segment>
              </include>



              <fieldMap ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/fieldMap">
                <fieldNames hint="raw:AddFieldByFieldName">
                  <field fieldName="predictive_search_keywords" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
                    <analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
                  </field>
                </fieldNames>
              </fieldMap>
              <include hint="list:IncludeField">
              </include>
            </configuration>


            <strategies hint="list:AddStrategy">
              <strategy ref="contentSearch/indexUpdateStrategies/onPublishEndAsync" />
            </strategies>


            <commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, Sitecore.ContentSearch">
              <policies hint="list:AddCommitPolicy">
                <policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, Sitecore.ContentSearch" />
              </policies>
            </commitPolicyExecutor>
            <locations hint="list:AddCrawler">
              <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
                <Database>web</Database>
                <Root>/sitecore/content</Root>
              </crawler>
            </locations>
          </index>
        </indexes>
      </configuration>
    </contentSearch>
  </sitecore>
</configuration>

Thanks,

0

There are 0 answers