Exclude an item field from full-text search

Abstract

Shows how you exclude content of item fields from being included in full text search.

By default, Sitecore aggregates content of all text fields in an item into a special index field. This happens during index update/rebuild operations, and it enables the full-text search feature. To use the full-text search feature, Sitecore queries the _content index field.

Note

The Azure Search Service does not support index field names that start with an underscore. When you use the full-text search feature with the Azure Search provider, the content_1 field is queried instead.

To exclude fields from full-text search:

  1. Open the App_Config\Sitecore\ContentSearch\Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config file, and navigate to the <exclude hint="list:AddExcludedFieldFromFullTextSearch"> node. This node contains a list of fields that are already excluded:

     <exclude hint="list:AddExcludedFieldFromFullTextSearch">
           <__Created>{25BED78C-4957-4165-998A-CA1B52F67497}</__Created>
           <__DefaultWorkflow>{CA9B9F52-4FB0-4F87-A79F-24DEA62CDA65}</__DefaultWorkflow>
           <__Lock>{001DD393-96C5-490B-924A-B0F25CD9EFD8}</__Lock>
           <__LongDescription>{577F1689-7DE4-4AD2-A15F-7FDC1759285F}</__LongDescription>
            <__Originator>{F6D8A61C-2F84-4401-BD24-52D2068172BC}</__Originator>
            ...
      </exclude>
  2. Patch the configuration to add the fields you need by entering the ID of each field in the format shown above (for example <__LongDescription>{577F1689-7DE4-4AD2-A15F-7FDC1759285F}</__LongDescription>).

  3. Optionally, to exclude a field that contains sensitive data from all indexing, do the following:.

    • If the value of the indexAllFields setting is true, add the field to the lists in <exclude hint="list:AddExcludedField"> and <exclude hint="list:AddExcludedFieldFromFullTextSearch">.

    • If the value of the <indexAllFields setting is false, add the field to the list in <exclude hint="list:AddExcludedFieldFromFullTextSearch">.

      Note

      This is independent from the <exclude hint="list:AddExcludedField"> and <include hint="list:AddIncludedField"> settings. A Sitecore item field is only excluded from the _content Solr field if it is listed in the <exclude hint="list:AddExcludedFieldFromFullTextSearch"> list. Therefore, even if you only index whitelisted fields, you can still search for unindexed fields when you use full-text search.