<?xml version="1.0" encoding="UTF-8" ?>

<!--
 This is the Solr schema file. This file should be named "managed-schema" and
 should be in the conf directory under the solr home
 (i.e. ./solr/conf/managed-schema by default)
 or located where the classloader for the Solr webapp can find it.
-->
<schema version="1.6">

    <fields>
        <!-- Valid attributes for fields:
          name: mandatory - the name for the field
          type: mandatory - the name of a field type from the
            <types> fieldType section
          indexed: true if this field should be indexed (searchable or sortable)
          stored: true if this field should be retrievable
          docValues: true if this field should have doc values. Doc values are
            useful for faceting, grouping, sorting and function queries. Although not
            required, doc values will make the index faster to load, more
            NRT-friendly and more memory-efficient. They however come with some
            limitations: they are currently only supported by StrField, UUIDField
            and all Trie*Fields, and depending on the field type, they might
            require the field to be single-valued, be required or have a default
            value (check the documentation of the field type you're interested in
            for more information)
          multiValued: true if this field may contain multiple values per document
          omitNorms: (expert) set to true to omit the norms associated with
            this field (this disables length normalization and index-time
            boosting for the field, and saves some memory).  Only full-text
            fields or fields that need an index-time boost need norms.
            Norms are omitted for primitive (non-analyzed) types by default.
          termVectors: [false] set to true to store the term vector for a
            given field.
            When using MoreLikeThis, fields used for similarity should be
            stored for best performance.
          termPositions: Store position information with the term vector.
            This will increase storage costs.
          termOffsets: Store offset information with the term vector. This
            will increase storage costs.
          required: The field is required.  It will throw an error if the
            value does not exist
          default: a value that should be used if no value is specified
            when adding a document.
        -->

        <!-- field names should consist of alphanumeric or underscore characters only and
           not start with a digit.  This is not currently strictly enforced,
           but other field names will not have first class support from all components
           and back compatibility is not guaranteed.  Names with both leading and
           trailing underscores (e.g. _version_) are reserved.
        -->


        <!-- CHECK: -->
        <!-- ??? virtual field ??? - phase -->

        <!--
            Unique field, contains of meta_id and language code combination delimited with underscore.
            Currently only default version is indexed.
            ex: 1001_en, 1001_se.

            In multi-version support index will contain solr docs for document's meta and content.
            Meta index id field value will eq meta id value (1001, 1002, ...)
            Content index id field value will include version no prior to language code (1001_0_en, 1001_1_en, ...)
        -->
        <field name="id" type="string" indexed="true" stored="true" required="true"/>

        <!--
        indicate when each document was indexed.
        -->
        <field name="timestamp" type="date" indexed="true" stored="true" default="NOW" required="true"/>

             <!-- language code - i.e en, se -->
        <field name="language" type="text_general" indexed="true" stored="true" required="true" multiValued="true"/>

        <!--
            Should be of type int.
            Unfortunately some legacy imCMS clients use this field in queries with text value.
         -->
        <field name="meta_id" type="string" indexed="true" stored="true" required="true"/>
        <field name="version_no" type="int" indexed="true" stored="true" required="true"/>
        <field name="search_enabled" type="boolean" indexed="true" stored="false" required="true"/>


        <field name="role_id" type="int" indexed="true" stored="false" multiValued="true"/>
        <field name="meta_headline" type="string" indexed="true" stored="true" multiValued="true"/>
        <field name="meta_headline_keyword" type="string" indexed="true" stored="false" multiValued="true"/>
        <field name="meta_text" type="string" indexed="true" stored="false" multiValued="true"/>
        <field name="doc_type_id" type="int" indexed="true" stored="true"/>
        <field name="creator_id" type="int" indexed="true" stored="false"/>
        <field name="publisher_id" type="int" indexed="true" stored="false"/>
        <field name="created_datetime" type="date" indexed="true" stored="true"/>
        <field name="modified_datetime" type="date" indexed="true" stored="true"/>
        <field name="activated_datetime" type="date" indexed="true" stored="true"/>
        <field name="publication_start_datetime" type="date" indexed="true" stored="true"/>
        <field name="publication_end_datetime" type="date" indexed="true" stored="true"/>
        <field name="archived_datetime" type="date" indexed="true" stored="true"/>
        <!-- publication status -->
        <field name="status" type="int" indexed="true" stored="true"/>
        <!-- file-doc field -->
        <field name="mime_type" type="text_general" indexed="true" stored="false"/>
        <!-- category name -->
        <field name="category" type="text_general" indexed="true" stored="false" multiValued="true"/>
        <field name="category_id" type="int" indexed="true" stored="false" multiValued="true"/>
        <field name="category_type" type="text_general" indexed="true" stored="false" multiValued="true"/>
        <field name="category_type_id" type="int" indexed="true" stored="false" multiValued="true"/>
        <field name="keyword" type="text_general" indexed="true" stored="false" multiValued="true"/>
        <field name="parent_id" type="int" indexed="true" stored="false" multiValued="true"/>
        <field name="parent_menu_id" type="text_general" indexed="true" stored="false" multiValued="true"/>
        <field name="has_parents" type="boolean" indexed="true" stored="false"/>
        <field name="alias" type="string" indexed="true" stored="true"/>

        <field name="parents_count" type="int" indexed="true" stored="true" default="0"/>
        <field name="children_count" type="int" indexed="true" stored="true" default="0"/>

        <!-- for url-doc -->
        <field name="url" type="text_general" indexed="true" stored="true"/>

        <!--                 -->
        <!-- text-doc fields -->
        <!--                 -->
        <field name="template" type="text_general" indexed="true" stored="false"/>
        <field name="nonstripped_text" type="text_general" indexed="true" stored="false" multiValued="true"/>
        <field name="text" type="text_general_html_strip" indexed="true" stored="false" multiValued="true"/>
        <field name="child_id" type="int" indexed="true" stored="false" multiValued="true"/>
        <field name="has_children" type="boolean" indexed="true" stored="false"/>
        <field name="image_link_url" type="text_general" indexed="true" stored="false" multiValued="true"/>

        <!-- Dynamic field definitions allow using convention over configuration
            for fields via the specification of patterns to match field names.
            EXAMPLE:  name="*_i" will match any field ending in _i (like myid_i, z_i)
            RESTRICTION: the glob-like pattern in the name attribute must have
            a "*" only at the start or the end.  -->

        <dynamicField name="property.*" type="text_general" indexed="true" stored="false"/>
        <!-- text-doc field, name: text+textNo (including text in a loop) -->
        <dynamicField name="text*" type="text_general_html_strip" indexed="true" stored="false" multiValued="true"/>

        <dynamicField name="meta_headline_*" type="string" indexed="true" stored="true"/>
        <dynamicField name="meta_headline_keyword_*" type="string" indexed="true" stored="false"/>
        <dynamicField name="meta_text_*" type="string" indexed="true" stored="false"/>
        <!-- uncomment the following to ignore any fields that don't already match an existing
             field name or dynamic field, rather than reporting them as an error.
             alternately, change the type="ignored" to some other type e.g. "text" if you want
             unknown fields indexed and/or stored by default -->
        <!--dynamicField name="*" type="ignored" multiValued="true" /-->
    </fields>

    <!-- Field to use to determine and enforce document uniqueness.
       Unless this field is marked with required="false", it will be a required field
    -->
    <uniqueKey>id</uniqueKey>

    <!-- DEPRECATED: The defaultOperator (AND|OR) is consulted by various query parsers
     when parsing a query string to determine if a clause of the query should be marked as
     required or optional, assuming the clause isn't already marked by some operator.
     The default is OR, which is generally assumed so it is not a good idea to change it
     globally here.  The "q.op" request parameter takes precedence over this.
    <solrQueryParser defaultOperator="OR"/> -->

    <!-- copyField commands copy one field to another at the time a document
          is added to the index.  It's used either to index the same field differently,
          or to add multiple fields to the same field for easier/faster searching.
    -->

    <types>
        <!-- field type definitions. The "name" attribute is
           just a label to be used by field definitions.  The "class"
           attribute and any other attributes determine the real
           behavior of the fieldType.
             Class names starting with "solr" refer to java classes in the
           org.apache.solr.analysis package.
        -->

        <!-- field type definitions. The "name" attribute is
            just a label to be used by field definitions.  The "class"
            attribute and any other attributes determine the real
            behavior of the fieldType.
              Class names starting with "solr" refer to java classes in a
            standard package such as org.apache.solr.analysis
         -->

        <!-- The StrField type is not analyzed, but indexed/stored verbatim.
           It supports doc values but in that case the field needs to be
           single-valued and either required or have a default value.
          -->
        <fieldType name="string" class="solr.StrField" sortMissingLast="true" />

        <!-- boolean type: "true" or "false" -->
        <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>

        <!-- sortMissingLast and sortMissingFirst attributes are optional attributes are
             currently supported on types that are sorted internally as strings
             and on numeric types.
             This includes "string","boolean", and, as of 3.5 (and 4.x),
             int, float, long, date, double, including the "Trie" variants.
           - If sortMissingLast="true", then a sort on this field will cause documents
             without the field to come after documents with the field,
             regardless of the requested sort order (asc or desc).
           - If sortMissingFirst="true", then a sort on this field will cause documents
             without the field to come before documents with the field,
             regardless of the requested sort order.
           - If sortMissingLast="false" and sortMissingFirst="false" (the default),
             then default lucene sorting will be used which places docs without the
             field first in an ascending sort and last in a descending sort.
        -->

        <!--
          Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types.

          These fields support doc values, but they require the field to be
          single-valued and either be required or have a default value.
        -->
        <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
        <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
        <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
        <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>

        <!--
         Numeric field types that index each value at various levels of precision
         to accelerate range queries when the number of values between the range
         endpoints is large. See the javadoc for NumericRangeQuery for internal
         implementation details.

         Smaller precisionStep values (specified in bits) will lead to more tokens
         indexed per value, slightly larger index size, and faster range queries.
         A precisionStep of 0 disables indexing at different precision levels.
        -->
        <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
        <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>
        <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/>
        <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>

        <!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
             is a more restricted form of the canonical representation of dateTime
             http://www.w3.org/TR/xmlschema-2/#dateTime
             The trailing "Z" designates UTC time and is mandatory.
             Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
             All other components are mandatory.

             Expressions can also be used to denote calculations that should be
             performed relative to "NOW" to determine the value, ie...

                   NOW/HOUR
                      ... Round to the start of the current hour
                   NOW-1DAY
                      ... Exactly 1 day prior to now
                   NOW/DAY+6MONTHS+3DAYS
                      ... 6 months and 3 days in the future from the start of
                          the current day

             Consult the DateField javadocs for more information.

             Note: For faster range queries, consider the tdate type
          -->
        <fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>

        <!-- A Trie based date field for faster date range queries and date faceting. -->
        <fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0"/>


        <!--Binary data type. The data should be sent/retrieved in as Base64 encoded Strings -->
        <fieldtype name="binary" class="solr.BinaryField"/>


        <!-- solr.TextField allows the specification of custom text analyzers
             specified as a tokenizer and a list of token filters. Different
             analyzers may be specified for indexing and querying.

             The optional positionIncrementGap puts space between multiple fields of
             this type on the same document, with the purpose of preventing false phrase
             matching across fields.

             For more info on customizing your analyzer chain, please see
             http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
         -->

        <!-- A text field that only splits on whitespace for exact matching of words -->
        <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
            <analyzer>
                <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            </analyzer>
        </fieldType>


        <!-- A general text field that has reasonable, generic
             cross-language defaults: it tokenizes with StandardTokenizer,
         removes stop words from case-insensitive "stopwords.txt"
         (empty by default), and down cases.  At query time only, it
         also applies synonyms. -->
        <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
            <analyzer type="index">
                <tokenizer class="solr.StandardTokenizerFactory"/>
                <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
                <!--
                <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
                -->
                <filter class="solr.LowerCaseFilterFactory"/>
            </analyzer>
            <analyzer type="query">
                <tokenizer class="solr.StandardTokenizerFactory"/>
                <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
                <!--
                <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
                -->
                <filter class="solr.LowerCaseFilterFactory"/>
            </analyzer>
        </fieldType>


        <!-- Just like text_general except it reverses the characters of
         each token, to enable more efficient leading wildcard queries. -->
        <fieldType name="text_general_rev" class="solr.TextField" positionIncrementGap="100">
            <analyzer type="index">
                <tokenizer class="solr.StandardTokenizerFactory"/>
                <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
                <filter class="solr.LowerCaseFilterFactory"/>
                <filter class="solr.ReversedWildcardFilterFactory" withOriginal="true"
                        maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/>
            </analyzer>
            <analyzer type="query">
                <tokenizer class="solr.StandardTokenizerFactory"/>
                <!--
                <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
                -->
                <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
                <filter class="solr.LowerCaseFilterFactory"/>
            </analyzer>
        </fieldType>


        <!--
        KeywordTokenizer does no actual tokenizing, so the entire
        input string is preserved as a single token
        -->
        <!--<fieldType name="keyword_lowercase" class="solr.TextField">-->
            <!--<analyzer>-->
                <!--<tokenizer class="solr.KeywordTokenizerFactory"/>-->
                <!--<filter class="solr.LowerCaseFilterFactory"/>-->
            <!--</analyzer>-->
        <!--</fieldType>-->

        <fieldType name="text_general_html_strip" class="solr.TextField">
            <analyzer>
                <charFilter class="solr.HTMLStripCharFilterFactory"/>
                <tokenizer class="solr.StandardTokenizerFactory"/>
                <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
                <filter class="solr.LowerCaseFilterFactory"/>
            </analyzer>
        </fieldType>
    </types>

</schema>