3

I'm trying to setup custom Lucene indexing but getting An index with the name "sitecore_web_index" have already been added.. Here's my config files. Have I missed something out?

CustomSpatialIndex.config

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
        <indexTemplates hint="skip">
          <customIndexTemplate id="sitecore_web_index" type="Sitecore.ContentSearch.LuceneProvider.SwitchOnRebuildLuceneIndex,Sitecore.ContentSearch.LuceneProvider">
            <param desc="name">sitecore_web_index</param>
            <param desc="folder">sitecore_web_index</param>
            <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
            <strategies hint="list:AddStrategy">
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/rebuildAfterFullPublish" />
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsync" />
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/remoteRebuild" />
            </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/Spatial/Home</Root>
              </crawler>
            </locations>
            <configuration ref="contentSearch/indexConfigurations/SpatialConfiguration" />
          </customIndexTemplate>
        </indexTemplates>
        <indexes hint="list:AddIndex">
          <index id="sitecore_web_index"  ref="contentSearch/configuration/indexTemplates/customIndexTemplate" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
            <patch:attribute name="type">Sitecore.Spatial.Provider.Lucene.LuceneIndexWithSpatial, Sitecore.Spatial</patch:attribute>
          </index>
        </indexes>
      </configuration>
    </contentSearch>
  </sitecore>
</configuration>

SpatialConfiguration.config

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <onPublishEndAsyncSingleInstance type="Sitecore.ContentSearch.Maintenance.Strategies.OnPublishEndAsynchronousSingleInstanceStrategy, Sitecore.ContentSearch" singleInstance="true">
        <param desc="database">web</param>
        <CheckForThreshold>true</CheckForThreshold>
      </onPublishEndAsyncSingleInstance>

      <indexConfigurations>
        <SpatialConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
          <!-- update values as required -->
          <indexAllFields>false</indexAllFields>
          <initializeOnAdd>true</initializeOnAdd>
          <analyzer ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/analyzer" />
          <fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
            <fieldNames hint="raw:AddFieldByFieldName">
              <field fieldName="_uniqueid"            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>
              <field fieldName="Title"                    storageType="YES" indexType="TOKENIZED"       vectorType="YES" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />
              <field fieldName="Description"              storageType="YES" indexType="TOKENIZED"       vectorType="YES" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />

            </fieldNames>
          </fieldMap>

          <include hint="list:IncludeTemplate">
            <customPage>{6AF9F435-9303-46A7-99FC-B016F23C694B}</customPage>
          </include>

          <include hint="list:IncludeField">
            <fieldId>{1360019C-1E25-43F8-A51A-98ED246C1F3A}</fieldId>
            <fieldId>{073AEB54-DDEC-4B62-853A-C3BA043C6CVA}</fieldId>
          </include>

          <fieldReaders ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/fieldReaders" />
          <indexFieldStorageValueFormatter ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/indexFieldStorageValueFormatter" />
          <indexDocumentPropertyMapper ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/indexDocumentPropertyMapper" />
          <documentBuilderType>Sitecore.Spatial.Lucene.SpatialDocumentBuilder, Sitecore.Spatial</documentBuilderType>
        </SpatialConfiguration>

      </indexConfigurations>
    </contentSearch>
  </sitecore>
</configuration>
4
  • I would suggest to verify these two files Sitecore.ContentSearch.Lucene.Index.Web and Sitecore.ContentSearch.Solr.Index.Web, please check if both are enabled - without .EXAMPLE at the end of the file. Feb 20, 2017 at 12:32
  • 1
    Please Verfiy that you have two indexes from /sitecore/admin/showconfig.aspx Feb 20, 2017 at 12:45
  • 1
    You have id="sitecore_web_index" change where you have sitecore_web_index written to the name of your index
    – Anicho
    Feb 20, 2017 at 13:23
  • Try to see what all files the web index specified. Run this powershell and check the files Get-ChildItem -recurse | Select-String -pattern "sitecore_web_index" | group path | select name
    – Sumith P D
    Feb 20, 2017 at 14:24

3 Answers 3

8

If you open the showconfig page (hostname/sitecore/admin/showconfig.aspx) it will tell you all the indexes that Sitecore is loading specially the one that is causing you problem. It will show you something like this:

<index id="sitecore_web_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider" patch:source="Sitecore.ContentSearch.Solr.Index.Web.config">

IF you look at it you will notice that the sitecore_web_index in this example is being defined on the file Sitecore.ContentSearch.Solr.Index.Web.config and is being patched from it. Hopefully this will help you

2

If the /sitecore/admin/showconfig.aspx also does not work you can search for "sitecore_web_index" in the App_Config folder of your website and then you will find the wrong config.

-1

I've solved the problem by giving the index id different name.

1
  • Can you add a little more detail? Why did this solve the issue? Did you have an index appearing with the same name when you looked in the ShowConfig before you made the change? Where was the other index coming from? Etc. Feb 27, 2017 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.