0

I have created a custom index (Sitecore 9 Update 1) using the below config, hoping that the index would contain documents only corresponding to the 3 included templates. However my index includes all documents under the root node and is not filtered by these included templates alone.

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
  <sitecore role:require="Standalone or ContentDelivery or ContentManagement" search:require="solr">
    <contentSearch>
     <indexConfigurations>
      <articleSolrIndexConfiguration type="Sitecore.ContentSearch.SolrProvider.SolrIndexConfiguration, Sitecore.ContentSearch.SolrProvider">
      <initializeOnAdd>false</initializeOnAdd>

      <fieldMap type="Sitecore.ContentSearch.SolrProvider.SolrFieldMap, Sitecore.ContentSearch.SolrProvider">
        <typeMatches hint="raw:AddTypeMatch">
          <typeMatch typeName="guidCollection"     type="System.Collections.Generic.List`1[System.Guid]"     fieldNameFormat="{0}_sm"  multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="stringCollection"   type="System.Collections.Generic.List`1[System.String]"   fieldNameFormat="{0}_sm"  multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="intCollection"      type="System.Collections.Generic.List`1[System.Int32]"    fieldNameFormat="{0}_im"  multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="guid"               type="System.Guid"                                        fieldNameFormat="{0}_s"                                         settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="id"                 type="Sitecore.Data.ID, Sitecore.Kernel"                  fieldNameFormat="{0}_s"                                         settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="shortid"            type="Sitecore.Data.ShortID, Sitecore.Kernel"             fieldNameFormat="{0}_s"                                         settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="text"               type="System.String"                                      fieldNameFormat="{0}_t"   cultureFormat="_{1}"                  settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="string"             type="System.String"                                      fieldNameFormat="{0}_s"                                         settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="int"                type="System.Int32"                                       fieldNameFormat="{0}_tl"                                        settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="bool"               type="System.Boolean"                                     fieldNameFormat="{0}_b"                                         settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="datetime"           type="System.DateTime"                                    fieldNameFormat="{0}_tdt" format="yyyy-MM-dd'T'HH:mm:ss.FFF'Z'" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="long"               type="System.Int64"                                       fieldNameFormat="{0}_tl"                                        settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="float"              type="System.Single"                                      fieldNameFormat="{0}_tf"                                        settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="double"             type="System.Double"                                      fieldNameFormat="{0}_td"                                        settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="stringArray"        type="System.String[]"                                    fieldNameFormat="{0}_sm"  multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="intArray"           type="System.Int32[]"                                     fieldNameFormat="{0}_im"  multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="datetimeArray"      type="System.DateTime[]"                                  fieldNameFormat="{0}_dtm" multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
          <typeMatch typeName="datetimeCollection" type="System.Collections.Generic.List`1[System.DateTime]" fieldNameFormat="{0}_dtm" multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
        </typeMatches>

        <fieldNames hint="raw:AddFieldByFieldName">
          <field fieldName="__created_by"         returnType="string" />
          <field fieldName="__smallcreateddate"   returnType="datetime" format="yyyy-MM-dd'T'HH:mm:ss'Z'" />
          <field fieldName="__smallupdateddate"   returnType="datetime" format="yyyy-MM-dd'T'HH:mm:ss'Z'" />
          <field fieldName="__workflow_state"     returnType="string" />
          <field fieldName="extension"            returnType="text" />
          <field fieldName="title"                returnType="text" />
        </fieldNames>

        <fieldTypes hint="raw:AddFieldByFieldTypeName">
          <fieldType fieldTypeName="checkbox"                                                                                                 returnType="bool"             />
          <fieldType fieldTypeName="date|datetime"                                                                                            returnType="datetime"         />
          <fieldType fieldTypeName="html|rich text|single-line text|multi-line text|text|memo|image|reference"                                returnType="text"             />
          <fieldType fieldTypeName="word document"                                                                                            returnType="text"             />
          <fieldType fieldTypeName="integer"                                                                                                  returnType="long"             />
          <fieldType fieldTypeName="number"                                                                                                   returnType="float"            />
          <fieldType fieldTypeName="icon|droplist|grouped droplist"                                                                           returnType="string"           />
          <fieldType fieldTypeName="checklist|multilist|treelist|tree list|treelistex|tree list|multilist with search|treelist with search"   returnType="stringCollection" />
          <fieldType fieldTypeName="name lookup value list|name value list"                                                                   returnType="stringCollection" />
          <fieldType fieldTypeName="droplink|droptree|grouped droplink|tree"                                                                  returnType="stringCollection" />
        </fieldTypes>
      </fieldMap>

      <documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">
        <indexAllFields>false</indexAllFields>
        <include hint="list:AddIncludedTemplate">
          <ContentGroupPage>{A212D61B-69BB-41D2-9C21-2D2D534CAAB5}</ContentGroupPage>
          <SimpleArticlePage>{A1C555D5-C991-4439-92F7-BF9B74217AB2}</SimpleArticlePage>
          <BrandedArticlePage>{24EE12B5-CCBF-4810-ADF2-65E37274143C}</BrandedArticlePage>
        </include>

        <fields hint="raw:AddExcludedSpecialField">
          <remove type="both">AllTemplates</remove>
          <remove type="both">Created</remove>
          <remove type="both">Editor</remove>
          <remove type="both">Hidden</remove>
          <remove type="both">Icon</remove>
          <remove type="both">Links</remove>
          <remove type="both">Updated</remove>
        </fields>
      </documentOptions>

      <virtualFields type="Sitecore.ContentSearch.VirtualFieldProcessorMap, Sitecore.ContentSearch">
        <processors hint="raw:AddFromConfiguration">
          <add fieldName="daterange" type="Sitecore.ContentSearch.VirtualFields.DateRangeFieldProcessor, Sitecore.ContentSearch" />
          <add fieldName="_lastestversion" type="Sitecore.ContentSearch.VirtualFields.LatestVersionFieldProcessor, Sitecore.ContentSearch" />
          <add fieldName="updateddaterange" type="Sitecore.ContentSearch.VirtualFields.UpdatedDateRangeFieldProcessor, Sitecore.ContentSearch" />
          <add fieldName="_url" type="Sitecore.ContentSearch.VirtualFields.UniqueIdFieldProcessor, Sitecore.ContentSearch" />
          <add fieldName="_fullpath" type="Sitecore.ContentSearch.VirtualFields.FullPathFieldProcessor, Sitecore.ContentSearch" />
          <add fieldName="parsedcreatedby_s" type="Sitecore.ContentSearch.VirtualFields.CreatedByFieldProcessor, Sitecore.ContentSearch" />
        </processors>
      </virtualFields>
      <fieldReaders ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldReaders" />
      <indexFieldStorageValueFormatter ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/indexFieldStorageValueFormatter" />
      <indexDocumentPropertyMapper ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/indexDocumentPropertyMapper" />
      <documentBuilderType ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/documentBuilderType" />
      <defaultSearchSecurityOption ref="contentSearch/indexConfigurations/defaultSearchSecurityOption" />
    </articleSolrIndexConfiguration>
  </indexConfigurations>

  <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
    <indexes hint="list:AddIndex">
      <index id="Site_articles_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
        <param desc="name">$(id)</param>
        <param desc="core">Site_articles_index</param>
        <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
        <configuration ref="contentSearch/indexConfigurations/articleSolrIndexConfiguration" />
        <strategies hint="list:AddStrategy">
          <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsyncSingleInstance" />
        </strategies>
        <locations hint="list:AddCrawler">
          <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
            <Database>web</Database>
            <Root>/sitecore/content/Site/Home</Root>
          </crawler>
        </locations>
        <enableItemLanguageFallback>false</enableItemLanguageFallback>
        <enableFieldLanguageFallback>false</enableFieldLanguageFallback>
      </index>
    </indexes>
  </configuration>
</contentSearch>

Any ideas on what I am missing here?

1

You need to set IndexAllFields parameter to false in order to include only items based on your desired templates. By default it is set to true. Take a look here for further details - https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/search_and_indexing/the_search_and_indexing_configuration_files

You shouldn't use OOTB search index configuration but create your custom one:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <!-- Configuration sections for indexes -->
      <indexConfigurations>

        <!-- If an index has no configuration specified, it will use the configuration below. The configuration is not merged if the index also has
             configuration, it is either this configuration or the index configuration. -->
        <CustomSearchIndexConfiguration type="Sitecore.ContentSearch.SolrProvider.SolrIndexConfiguration, Sitecore.ContentSearch.SolrProvider">
          <!-- This flag will index all fields by default. This allows new fields in your templates to automatically be included into the index.
               You have two choices : 

               1) Set this to true and place all the fields you would like to remove in the 'ExcludeField' list below.
               2) Set to false and place all fields you would like to be indexed in the 'IncludeField' list below.
            -->
          <indexAllFields>false</indexAllFields>

          <!-- Should index Initialize() method be called as soon as the index is added or wait for an external trigger -->
          <!-- For Solr Initialize() needs to be called after the IOC container has fired up -->
          <initializeOnAdd>false</initializeOnAdd>

          <!-- DEFAULT FIELD MAPPING 
               This field map allows you to take full control over how your data is stored in the index. This can affect the way data is queried, performance of searching and how data is retrieved and casted to a proper type in the API. 
            -->
          <fieldMap type="Sitecore.ContentSearch.SolrProvider.SolrFieldMap, Sitecore.ContentSearch.SolrProvider">
            <!-- This element must be first -->
            <typeMatches hint="raw:AddTypeMatch">
              <typeMatch typeName="guidCollection"     type="System.Collections.Generic.List`1[System.Guid]"     fieldNameFormat="{0}_sm"  multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="stringCollection"   type="System.Collections.Generic.List`1[System.String]"   fieldNameFormat="{0}_sm"  multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="intCollection"      type="System.Collections.Generic.List`1[System.Int32]"    fieldNameFormat="{0}_im"  multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="guid"               type="System.Guid"                                        fieldNameFormat="{0}_s"                                         settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="id"                 type="Sitecore.Data.ID, Sitecore.Kernel"                  fieldNameFormat="{0}_s"                                         settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="shortid"            type="Sitecore.Data.ShortID, Sitecore.Kernel"             fieldNameFormat="{0}_s"                                         settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="text"               type="System.String"                                      fieldNameFormat="{0}_t"   cultureFormat="_{1}"                  settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="string"             type="System.String"                                      fieldNameFormat="{0}_s"                                         settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="int"                type="System.Int32"                                       fieldNameFormat="{0}_tl"                                        settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="bool"               type="System.Boolean"                                     fieldNameFormat="{0}_b"                                         settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="datetime"           type="System.DateTime"                                    fieldNameFormat="{0}_tdt" format="yyyy-MM-dd'T'HH:mm:ss.FFF'Z'" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="long"               type="System.Int64"                                       fieldNameFormat="{0}_tl"                                        settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="float"              type="System.Single"                                      fieldNameFormat="{0}_tf"                                        settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="double"             type="System.Double"                                      fieldNameFormat="{0}_td"                                        settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="stringArray"        type="System.String[]"                                    fieldNameFormat="{0}_sm"  multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="intArray"           type="System.Int32[]"                                     fieldNameFormat="{0}_im"  multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="datetimeArray"      type="System.DateTime[]"                                  fieldNameFormat="{0}_dtm" multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
              <typeMatch typeName="datetimeCollection" type="System.Collections.Generic.List`1[System.DateTime]" fieldNameFormat="{0}_dtm" multiValued="true"                    settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
            </typeMatches>

            <!-- This allows you to map a field name in Sitecore to the index and store it in the appropriate way -->
            <!-- Add schema fields here to enable multi-language processing -->
            <fieldNames hint="raw:AddFieldByFieldName">
              <field fieldName="__created_by"         returnType="string" />
              <field fieldName="__smallcreateddate"   returnType="datetime" format="yyyy-MM-dd'T'HH:mm:ss'Z'" />
              <field fieldName="__smallupdateddate"   returnType="datetime" format="yyyy-MM-dd'T'HH:mm:ss'Z'" />
              <field fieldName="__workflow_state"     returnType="string" />
              <field fieldName="extension"            returnType="text" />
              <field fieldName="title"                returnType="text" />
            </fieldNames>

            <!-- FIELD TYPE MAPPING
                 This allows you to map a field type in Sitecore to a type in the index.
                 USAGE: When you add new field types to Sitecore, add the mappings here so they work through the Linq Layer 
              -->
            <fieldTypes hint="raw:AddFieldByFieldTypeName">
              <fieldType fieldTypeName="checkbox"                                                                                                 returnType="bool"             />
              <fieldType fieldTypeName="date|datetime"                                                                                            returnType="datetime"         />
              <fieldType fieldTypeName="html|rich text|single-line text|multi-line text|text|memo|image|reference"                                returnType="text"             />
              <fieldType fieldTypeName="word document"                                                                                            returnType="text"             />
              <fieldType fieldTypeName="integer"                                                                                                  returnType="long"             />
              <fieldType fieldTypeName="number"                                                                                                   returnType="float"            />
              <fieldType fieldTypeName="icon|droplist|grouped droplist"                                                                           returnType="string"           />
              <fieldType fieldTypeName="checklist|multilist|treelist|tree list|treelistex|tree list|multilist with search|treelist with search"   returnType="stringCollection" />
              <fieldType fieldTypeName="name lookup value list|name value list"                                                                   returnType="stringCollection" />
              <fieldType fieldTypeName="droplink|droptree|grouped droplink|tree"                                                                  returnType="stringCollection" />
            </fieldTypes>
          </fieldMap>

          <documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">
            <!-- GLOBALLY INCLUDE TEMPLATES IN INDEX
               This setting allows you to only include items that are based on specific templates in the index. You must specify all the
               templates that you want to include, because template inheritance is not checked. 
               When you enable this setting, all the items that are based on other templates are excluded, regardless of whether the template
               is specified in the ExcludeTemplate list or not.
            -->
             <include hint="list:AddIncludedTemplate">
               <ContentGroupPage>{A212D61B-69BB-41D2-9C21-2D2D534CAAB5}</ContentGroupPage>
               <SimpleArticlePage>{A1C555D5-C991-4439-92F7-BF9B74217AB2}</SimpleArticlePage>
               <BrandedArticlePage>{24EE12B5-CCBF-4810-ADF2-65E37274143C}</BrandedArticlePage>
            </include>

            <!-- GLOBALLY INCLUDE FIELDS IN INDEX
               This setting allows you to specify which fields to include in the index when the indexAllFields setting is set to false.
            -->
            <!--<include hint="list:AddIncludedField">
            <__Created>{25BED78C-4957-4165-998A-CA1B52F67497}</__Created>
            </include>-->

            <!-- GLOBALLY EXCLUDE FIELDS FROM BEING INDEXED
               This setting allows you to exclude fields from the index when the indexAllFields setting is set to true.
            -->
            <!--<exclude hint="list:AddExcludedField">
              <__Created>{25BED78C-4957-4165-998A-CA1B52F67497}</__Created>
            </exclude>-->

            <!-- REMOVE INBUILT SITECORE FIELDS
               This allows you to store a field in different ways in the index. You may want to store a field as Analyzed and Not Analyze
            -->
            <fields hint="raw:AddExcludedSpecialField">
              <remove type="both">AllTemplates</remove>
              <remove type="both">Created</remove>
              <remove type="both">Editor</remove>
              <remove type="both">Hidden</remove>
              <remove type="both">Icon</remove>
              <remove type="both">Links</remove>
              <remove type="both">Updated</remove>
            </fields>
          </documentOptions>

          <mediaIndexing ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/mediaIndexing" />

          <!-- VIRTUAL FIELDS
               Virtual fields can be used to translate a field query into a different query.
            -->
          <virtualFields type="Sitecore.ContentSearch.VirtualFieldProcessorMap, Sitecore.ContentSearch">
            <processors hint="raw:AddFromConfiguration">
              <add fieldName="daterange" type="Sitecore.ContentSearch.VirtualFields.DateRangeFieldProcessor, Sitecore.ContentSearch" />
              <add fieldName="_lastestversion" type="Sitecore.ContentSearch.VirtualFields.LatestVersionFieldProcessor, Sitecore.ContentSearch" />
              <add fieldName="updateddaterange" type="Sitecore.ContentSearch.VirtualFields.UpdatedDateRangeFieldProcessor, Sitecore.ContentSearch" />
              <add fieldName="_url" type="Sitecore.ContentSearch.VirtualFields.UniqueIdFieldProcessor, Sitecore.ContentSearch" />
              <add fieldName="_fullpath" type="Sitecore.ContentSearch.VirtualFields.FullPathFieldProcessor, Sitecore.ContentSearch" />
              <add fieldName="parsedcreatedby_s" type="Sitecore.ContentSearch.VirtualFields.CreatedByFieldProcessor, Sitecore.ContentSearch" />
            </processors>
          </virtualFields>

          <!-- SITECORE FIELDTYPE MAP
               This maps a field type by name to a Strongly Typed Implementation of the field type e.g. html maps to HTMLField
            -->
          <fieldReaders ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldReaders" />

          <!-- INDEX FIELD STORAGE MAPPER 
               Maintains a collection of all the possible Convertors for the provider.
            -->
          <indexFieldStorageValueFormatter ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/indexFieldStorageValueFormatter" />

          <!-- INDEX PROPERTY TO DOCUMENT MAPPER
               Maintains a collection of all the possible Convertors for the provider.
            -->
          <indexDocumentPropertyMapper ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/indexDocumentPropertyMapper" />


          <!-- DOCUMENT BUILDER
               Allows you to override the document builder. The document builder class processes all the fields in the Sitecore items and prepares
               the data for storage in the index.
               You can override the document builder to modify how the data is prepared, and to apply any additional logic that you may require.
          -->
          <documentBuilderType ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/documentBuilderType" />

          <defaultSearchSecurityOption ref="contentSearch/indexConfigurations/defaultSearchSecurityOption" />

        </CustomSearchIndexConfiguration>
      </indexConfigurations>
    </contentSearch>
  </sitecore>
</configuration>

And now how your index definition should look like with configuration that we have created above:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
        <indexes hint="list:AddIndex">
          <index id="Site_articles_index" type="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
            <param desc="name">$(id)</param>
            <param desc="core">$(id)</param>
            <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
            <configuration ref="contentSearch/indexConfigurations/CustomSearchIndexConfiguration" />
            <strategies hint="list:AddStrategy">
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsync" />
            </strategies>
            <locations hint="list:AddCrawler">
              <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
                <Database>web</Database>
                <Root>/sitecore/content/Site/Home</Root>
              </crawler>
            </locations>
            <enableItemLanguageFallback>false</enableItemLanguageFallback>
            <enableFieldLanguageFallback>false</enableFieldLanguageFallback>
          </index>
        </indexes>
      </configuration>
    </contentSearch>
  </sitecore>
</configuration>
7
  • I added the config, I presume it needs to be under documentOptions as in the default indexes. But still seeing the same issue. Restarted SOLR service and IIS and rebuilt the index, and then searched in SOLR console using a template name - not included in the list in my config, results are showing up - which shouldnt. Apr 16 '18 at 7:13
  • Have you rebuild index? Apr 16 '18 at 7:14
  • Also, would indexAllFields setting affect ExcludedTemplate/IncludedTemplate? And not just ExcludedField/IncludedField? Apr 16 '18 at 7:22
  • Answer updated to suit your needs more. I recommend creating custom index configuration Apr 16 '18 at 7:46
  • Unfortunately it still isn't working. I still see other template documents in the index. Apr 16 '18 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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