dotPeekser.SC.Solr.ManagedSchema 1.0.0

dotnet add package dotPeekser.SC.Solr.ManagedSchema --version 1.0.0
NuGet\Install-Package dotPeekser.SC.Solr.ManagedSchema -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="dotPeekser.SC.Solr.ManagedSchema" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add dotPeekser.SC.Solr.ManagedSchema --version 1.0.0
#r "nuget: dotPeekser.SC.Solr.ManagedSchema, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install dotPeekser.SC.Solr.ManagedSchema as a Cake Addin
#addin nuget:?package=dotPeekser.SC.Solr.ManagedSchema&version=1.0.0

// Install dotPeekser.SC.Solr.ManagedSchema as a Cake Tool
#tool nuget:?package=dotPeekser.SC.Solr.ManagedSchema&version=1.0.0

dotPeekser.SC.Solr.ManagedSchema

Provides a processor to configure the managed-schema through Sitecore.
The definition is based on the solr documentation: https://solr.apache.org/guide/8_2/schema-api.html

If a field or type already exists in solr it will be replaced. If you want to delete a specific field, the node needs to have the delete attribute with the value true in place. delete="true"

Sitecore removes all fields and types by default on every �Populate Schema� process and populates it with his own configured data. This documentation provides a flexible way to add dynamically new definitions to the managed-schema file. <br />

Caveat Example: If you configure an auto suggest handler which references a new created type you have to configure the new type in the managed-schema file even if its defined with this configuration. If you don't do it you will have a corrupt managed-schema file because solr checks the file before Sitecore populates it. Workaround: Configure it in both places to ensure the new field still exists after populate.

Compatibility list

Sitecore Version Project Version
10.2 >=1.0.0

Base Configuration

Base node for the configuration

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <solr.customSolrManagedSchema>
        
      </solr.customSolrManagedSchema>
    </contentSearch>
  </sitecore>
</configuration>

To apply field or type configurations, you have to define a command to reference the fields to one or multiple indexes.

To apply the configurations to a specific index, for example sitecore_master_index and sitecore_web_index you have to set the applyToIndex attribute. Each index have to be separated through a pipe character |.
If you want to apply your configuration to all indicies you can set the value to all.

<commands applyToIndex="sitecore_master_index|sitecore_web_index">
</command>

Available Command Node Attributes

applyToIndex - Which index should be modified with the configured field and types

Supported Field / Types

DynamicField, CopyField, Field, Type

Supported Field / Type Attributes

delete="true" - Definition if a field or type should be deleted

Examples (Snippets)

Dynamic Field
Add two dynamic fields *_ls_en and *_ls_de

<DynamicField>
  <name>*_ls_en</name>
  <type>lang_string</type>
  <indexed>true</indexed>
  <stored>true</stored>
</DynamicField>

<DynamicField>
  <name>*_ls_de</name>
  <type>lang_string</type>
  <indexed>true</indexed>
  <stored>true</stored>
</DynamicField>

Copy Field
Add a CopyField

<DynamicField>
  <name>*_ls_en</name>
  <type>lang_string</type>
  <indexed>true</indexed>
  <stored>true</stored>
</DynamicField>

<DynamicField>
  <name>*_ls_de</name>
  <type>lang_string</type>
  <indexed>true</indexed>
  <stored>true</stored>
</DynamicField>

Field Type
Configuration to replace text_en and text_de to have separate synonym.txt file for each language.
Ensure that all referenced filesystem files (ex. synonyms_de.txt) are placed in the correct solr folder before applying this configuration, otherwise this will have no effect! Sitecore does not show this as an error.


<Type>
  <name>text_de</name>
  <class>solr.TextField</class>
  <positionIncrementGap>100</positionIncrementGap>
  <indexAnalyzer>
    <tokenizer>
      <class>solr.StandardTokenizerFactory</class>
    </tokenizer>
    <filters>
      <class>solr.LowerCaseFilterFactory</class>
    </filters>
    <filters>
      <class>solr.StopFilterFactory</class>
      <format>snowball</format>
      <words>lang/stopwords_de.txt</words>
      <ignoreCase>true</ignoreCase>
    </filters>
    <filters>
      <class>solr.GermanNormalizationFilterFactory</class>
    </filters>
    <filters>
      <class>solr.GermanLightStemFilterFactory</class>
    </filters>
  </indexAnalyzer>
  <queryAnalyzer>
    <tokenizer>
      <class>solr.StandardTokenizerFactory</class>
    </tokenizer>
    <filters>
      <class>solr.LowerCaseFilterFactory</class>
    </filters>
    <filters>
      <class>solr.SynonymGraphFilterFactory</class>
      <expand>true</expand>
      <ignoreCase>true</ignoreCase>
      <synonyms>lang/synonyms_de.txt</synonyms>
    </filters>
    <filters>
      <class>solr.StopFilterFactory</class>
      <format>snowball</format>
      <words>lang/stopwords_de.txt</words>
      <ignoreCase>true</ignoreCase>
    </filters>
    <filters>
      <class>solr.GermanNormalizationFilterFactory</class>
    </filters>
    <filters>
      <class>solr.GermanLightStemFilterFactory</class>
    </filters>
  </queryAnalyzer>
</Type>

<Type>
  <name>text_en</name>
  <class>solr.TextField</class>
  <positionIncrementGap>100</positionIncrementGap>
  <indexAnalyzer>
    <tokenizer>
      <class>solr.StandardTokenizerFactory</class>
    </tokenizer>
    <filters>
      <class>solr.StopFilterFactory</class>
      <words>lang/stopwords_en.txt</words>
      <ignoreCase>true</ignoreCase>
    </filters>
    <filters>
      <class>solr.LowerCaseFilterFactory</class>
    </filters>
    <filters>
      <class>solr.EnglishPossessiveFilterFactory</class>
    </filters>
    <filters>
      <class>solr.KeywordMarkerFilterFactory</class>
      <protected>protwords.txt</protected>
    </filters>
    <filters>
      <class>solr.PorterStemFilterFactory</class>
    </filters>
  </indexAnalyzer>
  <queryAnalyzer>
    <tokenizer>
      <class>solr.StandardTokenizerFactory</class>
    </tokenizer>
    <filters>
      <class>solr.SynonymGraphFilterFactory</class>
      <expand>true</expand>
      <ignoreCase>true</ignoreCase>
      <synonyms>lang/synonyms_en.txt</synonyms>
    </filters>
    <filters>
      <class>solr.StopFilterFactory</class>
      <words>lang/stopwords_en.txt</words>
      <ignoreCase>true</ignoreCase>
    </filters>
    <filters>
      <class>solr.LowerCaseFilterFactory</class>
    </filters>
    <filters>
      <class>solr.EnglishPossessiveFilterFactory</class>
    </filters>
    <filters>
      <class>solr.KeywordMarkerFilterFactory</class>
      <protected>protwords.txt</protected>
    </filters>
    <filters>
      <class>solr.PorterStemFilterFactory</class>
    </filters>
  </queryAnalyzer>
</Type>

For full examples take a look on this link. Click here.

Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 685 2/24/2023