Gravatar for vivekit91@gmail.com

Question by astle, Apr 17, 2018 6:57 AM

How to remove the fz95xcreator43506 and fz95xeditor43506 field from Coveo indexing?

Hi,

We need to remove the Creator and Editor details from Coveo response for security exception. Is there any way to remove the fields from indexing?.

2 Replies
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Apr 17, 2018 9:51 AM

Hi,

Excluding fields from a Coveo for Sitecore index is the same process as with Lucene or Solr. You have to add the field in the Sitecore configuration as explained in the documentation: Specify which Fields to Index

Gravatar for vivekit91@gmail.com

Comment by astle, Apr 20, 2018 5:57 AM

Hi Jean,

Thanks for your reply.

Coveo already referring the exclude fields from Lucene config and lucene is excluding the creator and editor details. But still we are getting the creator and editor details.

<factory id="excludedFieldsFactory" type="Coveo.SearchProvider.FirstAvailableRemoteListFactory, Coveo.SearchProviderBase">
        <xpaths hint="list:AddXPath">
          <xpath name="Lucene">contentSearch/indexConfigurations/defaultLuceneIndexConfiguration//exclude[@hint='list:ExcludeField']</xpath>
        </xpaths>
      </factory>

We have followed the document https://developers.coveo.com/display/public/SitecoreV4/Removing+Fields+From+Search+Results , and it is working in CM but not in CD

Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Apr 20, 2018 10:09 AM

The configuration node you posted is just a factory. It requires to be referenced by the Coveo default index configuration to be used.

Do you have the following element in your Coveo default index configuration (`/coveo/defaultIndexConfiguration/documentOptions`)?

<exclude hint="list:AddExcludedField" ref="mandatory, do not delete" factory="excludedFieldsFactory" />

I just checked the Lucene default index configuration. While it contains fields to exclude elements named "Editor", the real Sitecore item names of these are either "Editor" or "__Editor" (With 2 leading underscore characters) while you are trying to remove a field named "_editor" (with a single leading underscore character as per the "z95x" in front of the Coveo field name you provided).

The Lucene default index configuration does not exclude a "_creator" field. It instead configures it:

<field fieldName="creator" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">

I also cannot find the "editor" and "_creator" fields in the content tree. This means those fields are not in a template but are added programmatically by Sitecore on items. Because of that, we cannot exclude then using the AddExcludedField configuration section.

If you want to remove those fields at indexing time, you have a few options:

  1. Write and add a processor for the coveoIndexingGetFields pipeline that would exclude those 2 fields. This is the pipeline that decides which fields will be created in the Coveo index. If your 2 fields are not created in the Coveo index in the first place, they will not be indexed for Sitecore items.
  2. Or write and add a processor for the coveoPostItemProcessingPipeline pipeline that would remove those 2 Sitecore fields meta data from the ICoveoIndexable object. This pipeline offers you the possibility to modify the data sent to the Coveo index for an item. It runs after Coveo for Sitecore has read the Sitecore fields.

If you want to exclude the fields at query time (more costly because the processor is run more often), you can follow the documentation you already found. Note that you need your assembly and configuration on each of your Sitecore instances (CM, CD…)

Ask a question