Gravatar for dante.ciambella@gmserv.com

Question by danteciambella, Nov 10, 2016 11:48 AM

Index rebuild from sitecore crash

Good morning Guys,

I installed the following Coveo component with Sitecore 8.2 initial release:

  • Coveo Enterprise Search 7.0 x64 (8541) for Sitecore.exe
  • Coveo Search API 8.0.1130.exe
  • Coveo for Sitecore 82 4.0 (450)

when I try to rebuild the index using Control Panel Index Manager I have the following trap:

Job started: Index_Update_IndexName=Coveo_master_index|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Sequence contains more than one matching element
   at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Coveo.AbstractLayer.FieldManagement.AdminModuleFieldsHandler.GetCesFieldsToDeleteAndAdd(IEnumerable`1 p_CesFields, IEnumerable`1 p_SitecoreFields, List`1& p_CesFieldsToDelete, IList`1& p_CesFieldsToAdd)
   at Coveo.AbstractLayer.FieldManagement.AdminModuleFieldsHandler.UpdateFieldSetAndFields(String p_FieldSetName, String p_IndexName, ForeignKeysConfiguration p_ForeignKeysConfiguration)
   at Coveo.AbstractLayer.Communication.CES.AdminModule.SetUpRequirements(String p_ServerUrl, String p_TargetSite, Boolean p_ExpandUsers, ForeignKeysConfiguration p_ForeignKeysConfiguration, IList`1 p_RankingIgnoredFields)
   at Coveo.AbstractLayer.Communication.CES.CESCommunication.InitializeAdminModule()
   at Coveo.AbstractLayer.Communication.CES.CESCommunication.Initialize()
   at Coveo.SearchProvider.AbstractProviderUpdateContext..ctor(ISearchIndexSummary p_IndexSummary, IIndexCommunication p_Communication)
   at Coveo.SearchProvider.ProviderUpdateContext..ctor(ISearchIndex p_Index, IIndexCommunication p_Communication)
   at Coveo.SearchProvider.ProviderIndex.CreateUpdateContext()
   at Coveo.SearchProvider.ProviderIndex.<Rebuild>b__3e()
   at Coveo.SearchProvider.ProviderIndex.TryPerformIndexingOperation(IndexingOptions p_IndexingOptions, Action p_Action)
   at Coveo.SearchProvider.ProviderIndex.Rebuild()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
   at Sitecore.Jobs.JobRunner.RunMethod(JobArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Jobs.Job.ThreadEntry(Object state)

I absolutely don't know why but seems that in the following call:

GetCesFieldsToDeleteAndAdd(System.Collections.Generic.IEnumerable<Coveo.AdminService.AdminService.FieldConfig> p_CesFields, System.Collections.Generic.IEnumerable<Coveo.Framework.Fields.Config.FieldConfig> p_SitecoreFields, out System.Collections.Generic.List<Coveo.AdminService.AdminService.FieldConfig> p_CesFieldsToDelete, out System.Collections.Generic.IList<Coveo.Framework.Fields.Config.FieldConfig> p_CesFieldsToAdd)

the source.SingleOrDefault((Coveo.Framework.Fields.Config.FieldConfig f) => f.CoveoFieldName == cesField.FieldName) return more than one element.

Please any suggestion?

Gravatar for dberube@coveo.com

Comment by Dominic Berube, Nov 10, 2016 12:07 PM

Hi,

Looks like you have 2 fields that ends up with the same CoveoFieldName (encoded for the index).

Please check your external fields to validate that you don't have 2 fields that are equal.

For example, a normal Sitecore field 'size' will get the CoveoFieldName 'fsiz122xe12345', 12345 being the hash of your source. If you have declare an external field (which are not encoded) called 'fsiz122xe12345', that error could occur.

Gravatar for dante.ciambella@gmserv.com

Comment by danteciambella, Nov 10, 2016 12:15 PM

Thank you very much for your support.. Sorry but I'm a newbie on Coveo. Where I need to check the external field to avoid 2 equal fields? Thanks in advance

Gravatar for dberube@coveo.com

Comment by Dominic Berube, Nov 10, 2016 12:20 PM

External fields are declared under the coveo/defaultIndexConfiguration/fieldMap config field section. Either in the fieldNames section (declared as isExternal=true) or in the externalFields section.

Gravatar for dante.ciambella@gmserv.com

Comment by danteciambella, Nov 11, 2016 3:42 AM

In the Coveo.SearchProvider.config I have the following fieldMap:

    <fieldMap type="Coveo.SearchProvider.CoveoFieldMap, Coveo.SearchProvider">
      <param desc="coveoReflectionFactory" type="Coveo.Framework.Utils.CoveoReflectionFactory, Coveo.Framework" />
      <fieldNames hint="raw:AddFieldByFieldName">
        <fieldType fieldName="_id" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" type="Sitecore.Data.ID, Sitecore.Kernel" returnType="System.String" />
        <fieldType fieldName="_uniqueid" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" type="Sitecore.Data.ItemUri, Sitecore.Kernel" returnType="System.String" />
        <fieldType fieldName="name" isFacet="true" isSortable="true" includeForFreeTextSearch="true" isMultiValue="false" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="fullpath" isSortable="false" isFacet="true" includeForFreeTextSearch="false" isMultiValue="false" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="_fullpath" isSortable="false" isFacet="true" includeForFreeTextSearch="false" isMultiValue="false" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="_group" isSortable="false" isFacet="true" includeForFreeTextSearch="false" isMultiValue="false" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="_name" isFacet="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="_displayname" isFacet="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="_path" isFacet="true" isMultiValue="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="_content" isFacet="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="alltemplates" isMultiValue="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="__smallcreateddate" sitecoreFormat="yyyyMMddTHHmmZ" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="__smallupdateddate" sitecoreFormat="yyyyMMddTHHmmZ" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="hasLayout" useForRanking="false" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="isMediaItem" useForRanking="false" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
        <fieldType fieldName="site" isMultiValue="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
      </fieldNames>
      <!-- Fields in this section are fields that doesn't exist on Sitecore items, but exist in CES or in external sources. -->
      <externalFields hint="raw:AddExternalField">
        <field fieldName="sysauthor" />
        <field fieldName="syscollection" />
        <field fieldName="sysconcepts" />
        <field fieldName="sysdate" />
        <field fieldName="syssource" />
        <field fieldName="sysrowid" />
      </externalFields>
    </fieldMap>

Not seems that I have some duplicated ExternalField. The Installation is clean I don't have done any customization. Thanks in advance.

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Nov 11, 2016 9:29 AM

Have you checked in your ShowConfig.aspx? You might have another file patching the default field map.

Gravatar for dante.ciambella@gmserv.com

Comment by danteciambella, Nov 11, 2016 9:40 AM

Ok this is the result using the showconfig.aspx:

<fieldMap type="Coveo.SearchProvider.CoveoFieldMap, Coveo.SearchProvider">
  <param type="Coveo.Framework.Utils.CoveoReflectionFactory, Coveo.Framework" desc="coveoReflectionFactory"/>
  <fieldNames hint="raw:AddFieldByFieldName">
    <fieldType type="Sitecore.Data.ID, Sitecore.Kernel" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="_id" returnType="System.String"/>
    <fieldType type="Sitecore.Data.ItemUri, Sitecore.Kernel" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="_uniqueid" returnType="System.String"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="name" isMultiValue="false" includeForFreeTextSearch="true" isSortable="true" isFacet="true"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="fullpath" isMultiValue="false" includeForFreeTextSearch="false" isSortable="false" isFacet="true"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="_fullpath" isMultiValue="false" includeForFreeTextSearch="false" isSortable="false" isFacet="true"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="_group" isMultiValue="false" includeForFreeTextSearch="false" isSortable="false" isFacet="true"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="_name" isFacet="true"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="_displayname" isFacet="true"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="_path" isMultiValue="true" isFacet="true"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="_content" isFacet="true"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="alltemplates" isMultiValue="true"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="__smallcreateddate" sitecoreFormat="yyyyMMddTHHmmZ"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="__smallupdateddate" sitecoreFormat="yyyyMMddTHHmmZ"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="hasLayout" useForRanking="false"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="isMediaItem" useForRanking="false"/>
    <fieldType settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" fieldName="site" isMultiValue="true"/>
  </fieldNames>
  <!-- Fields in this section are fields that do not exist on Sitecore items, but exist in CES or in external sources. -->
  <externalFields hint="raw:AddExternalField">
    <field fieldName="sysauthor"/>
    <field fieldName="syscollection"/>
    <field fieldName="sysconcepts"/>
    <field fieldName="sysdate"/>
    <field fieldName="syssource"/>
    <field fieldName="sysrowid"/>
  </externalFields>
</fieldMap>

Seems the same. Any other idea?

1 Reply
Gravatar for dante.ciambella@gmserv.com

Answer by danteciambella, Nov 14, 2016 6:32 AM

Seems I have found the solution before start Indexing from Sitecore Indexing Manager i need to Reset "Custom Fields" using Ces Administration: Configuration - Fields - Reset. After that I can rebuild indexes without the previous trap.

Ask a question