更新sitecore中的lucene搜索索引

时间:2015-06-12 13:36:51

标签: c# lucene sitecore search-engine sitecore7.2

我在sitecore 7.2初始版本中定义了lucene搜索索引。它的工作正常,但它没有在发布时自行更新。虽然我已经定义了索引更新了" OnPublishEndAsynchronousStrategy" &安培; " RebuildAfterFullPublishStrategy"策略如下。

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

但是在智能发布中发布单个项目时没有更新。

我还可以替代在代码

上发布时重建索引
Sitecore.ContentSearch.ContentSearchManager.GetIndex("SearchIndexName").Rebuild();

但它似乎不是一种正确/有效的方式。

参考配置代码:

<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>

谢谢,

0 个答案:

没有答案