Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-core/etc/elasticsuite_analysis.xsd

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Smile_ElasticsuiteCore analysis configuration validation.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
 * versions in the future.
 *
 * @category  Smile
 * @package   Smile\ElasticsuiteCore
 * @author    Aurelien FOUCRET <aurelien.foucret@smile.fr>
 * @copyright 2020 Smile
 * @license   Open Software License ("OSL") v. 3.0
 */
 -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="analysis">
        <xs:complexType>
            <xs:choice maxOccurs="unbounded">
                <xs:element name="char_filters" type="charFiltersDefinition"/>
                <xs:element name="filters" type="filtersDefinition" />
                <xs:element name="analyzers" type="analyzersDefinition"/>
                <xs:element name="normalizers" type="normalizersDefinition"/>
                <xs:element name="tokenizers" type="tokenizersDefinition"/>
                <xs:element name="stemmers" type="stemmersDefinition" />
            </xs:choice>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="charFiltersDefinition">
        <xs:annotation>
            <xs:documentation>
                Char filters declaration root node
            </xs:documentation>
        </xs:annotation>
        <xs:choice maxOccurs="unbounded">
            <xs:element name="char_filter" type="charFilterDefinition" />
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="charFilterDefinition">
        <xs:annotation>
            <xs:documentation>Char filter definition node</xs:documentation>
        </xs:annotation>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:any processContents="lax" />
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="type" type="xs:string" use="required" />
        <xs:attribute name="language" type="xs:string" use="required" />
    </xs:complexType>

    <xs:complexType name="filtersDefinition">
        <xs:annotation>
            <xs:documentation>Filters declaration root node</xs:documentation>
        </xs:annotation>
        <xs:choice maxOccurs="unbounded">
            <xs:element name="filter" type="filterDefinition" />
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="filterDefinition">
        <xs:annotation>
            <xs:documentation>Filter definition node</xs:documentation>
        </xs:annotation>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:any processContents="lax" />
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="type" type="xs:string" use="required" />
        <xs:attribute name="language" type="xs:string" use="required" />
    </xs:complexType>

    <xs:complexType name="normalizersDefinition">
        <xs:annotation>
            <xs:documentation>Normalizers declaration root node</xs:documentation>
        </xs:annotation>
        <xs:choice maxOccurs="unbounded">
            <xs:element name="normalizer" type="normalizerDefinition" />
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="normalizerDefinition">
        <xs:annotation>
            <xs:documentation>Normalizer definition node</xs:documentation>
        </xs:annotation>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="char_filters" type="analyzerCharFiltersOptional" />
            <xs:element name="filters" type="analyzerFilters" />
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="type" type="xs:string" use="required" />
        <xs:attribute name="language" type="xs:string" use="required" />
    </xs:complexType>

    <xs:complexType name="tokenizersDefinition">
        <xs:annotation>
            <xs:documentation>Tokenizers declaration root node</xs:documentation>
        </xs:annotation>
        <xs:choice maxOccurs="unbounded">
            <xs:element name="tokenizer" type="tokenizerDefinition" />
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="tokenizerDefinition">
        <xs:annotation>
            <xs:documentation>Tokenizer definition node</xs:documentation>
        </xs:annotation>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:any processContents="lax" />
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="type" type="xs:string" use="required" />
        <xs:attribute name="language" type="xs:string" use="required" />
    </xs:complexType>

    <xs:complexType name="analyzersDefinition">
        <xs:annotation>
            <xs:documentation>
                Analyzers declaration root node
            </xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:choice maxOccurs="unbounded">
                <xs:element name="analyzer" type="analyzerDefinition" />
            </xs:choice>
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="analyzerDefinition">
        <xs:annotation>
            <xs:documentation>Filter definition node</xs:documentation>
        </xs:annotation>
        <xs:choice maxOccurs="unbounded">
            <xs:element name="char_filters" type="analyzerCharFilters" />
            <xs:element name="filters" type="analyzerFilters" />
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="normalizer" type="xs:string" />
        <xs:attribute name="tokenizer" type="xs:string" use="required" />
        <xs:attribute name="language" type="xs:string" use="required" />
    </xs:complexType>

    <xs:complexType name="analyzerCharFilters">
        <xs:choice maxOccurs="unbounded">
            <xs:element name="char_filter" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="ref" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="analyzerCharFiltersOptional">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="char_filter" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="ref" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="analyzerFilters">
        <xs:choice maxOccurs="unbounded">
            <xs:element name="filter" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="ref" type="xs:string" use="required" />
                </xs:complexType>
            </xs:element>
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="stemmersDefinition">
        <xs:annotation>
            <xs:documentation>
                Stemmers declaration root node
            </xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:choice maxOccurs="unbounded">
                <xs:element name="group" type="stemmerGroupDefinition" />
            </xs:choice>
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="stemmerGroupDefinition">
        <xs:annotation>
            <xs:documentation>
                List of stemmers for a given language
            </xs:documentation>
        </xs:annotation>
        <xs:choice maxOccurs="unbounded">
            <xs:element name="stemmer" type="stemmerDefinition" />
        </xs:choice>
        <xs:attribute name="language" type="xs:string" use="required" />
        <xs:attribute name="title" type="xs:string" use="required" />
        <xs:attribute name="translate" type="xs:string" use="optional" />
    </xs:complexType>

    <xs:complexType name="stemmerDefinition">
        <xs:annotation>
            <xs:documentation>
                A specific stemmer for a given language
            </xs:documentation>
        </xs:annotation>
        <xs:choice minOccurs="1" maxOccurs="1">
            <xs:element name="label" type="xs:string" />
        </xs:choice>
        <xs:attribute name="identifier" type="xs:string" use="required" />
        <xs:attribute name="recommended" type="xs:boolean" use="optional" />
    </xs:complexType>

</xs:schema>