<?xml version="1.0" encoding="UTF-8" ?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

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

 This example schema is the recommended starting point for users.
 It should be kept correct and concise, usable out-of-the-box.

 For more information, on how to customize this file, please see
 http://wiki.apache.org/solr/SchemaXml
-->

<schema name="mosatags" version="1.1">

  <types>
  
    <fieldType name="type" class="solr.StrField" sortMissingLast="true" omitNorms="true" />
    <fieldType name="id" class="solr.IntField" omitNorms="true" />
    <fieldType name="uniqueId" class="solr.StrField" sortMissingLast="true" omitNorms="true"  />
    <fieldType name="title" class="solr.TextField" sortMissingLast="true" omitNorms="true" >
      <analyzer>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>
    <fieldType name="textdata" class="solr.TextField" sortMissingLast="true" omitNorms="true" >
      <analyzer>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.TrimFilterFactory" />
        <filter class="solr.SnowballPorterFilterFactory" language="French" />
      </analyzer>
    </fieldType>
    <fieldType name="tags" class="solr.TextField" sortMissingLast="true" omitNorms="true" >
      <analyzer>
        <tokenizer class="solr.StandardTokenizerFactory" pattern=",*" />
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.TrimFilterFactory" />
        <filter class="solr.SnowballPorterFilterFactory" language="French" />
      </analyzer>
    </fieldType>
    <fieldType name="personsList" class="solr.TextField" sortMissingLast="true" omitNorms="true" >
      <analyzer>
        <tokenizer class="solr.PatternTokenizerFactory" pattern="; *" />
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.TrimFilterFactory" />
      </analyzer>
    </fieldType>
   
  </types>


  <fields>
   <!-- Valid attributes for fields:
     name: mandatory - the name for the field
     type: mandatory - the name of a previously defined type from the <types> section
     indexed: true if this field should be indexed (searchable or sortable)
     stored: true if this field should be retrievable
     compressed: [false] if this field should be stored using gzip compression
       (this will only apply if the field type is compressable; among
       the standard field types, only TextField and StrField are)
     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.
     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.
   -->

   <field name="type" type="type" indexed="true" stored="true" required="true" />
   <field name="id" type="id" indexed="no" stored="true" required="true" /> 
   <field name="uniqueid" type="uniqueId" indexed="true" stored="true" required="true" />
   <field name="title" type="title"  indexed="true" stored="false" required="false" />
   <field name="original_title" type="title"  indexed="true" stored="false" required="false" />
   <field name="desc" type="textdata"  indexed="true" stored="false" required="false" />
   <field name="tags" type="tags"  indexed="true" stored="true" required="false" multiValued="true" />
   <field name="directors" type="personsList"  indexed="true" stored="false" required="false" />
   <field name="actors" type="personsList"  indexed="true" stored="false" required="false" />
   <field name="all" type="textdata" indexed="true" stored="true" required="false" 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>uniqueid</uniqueKey>

 <!-- field for the QueryParser to use when an explicit fieldname is absent -->
 <defaultSearchField>all</defaultSearchField>

 <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
 <solrQueryParser defaultOperator="OR"/>
 
 <copyField source="title" dest="all"/>
 <copyField source="desc" dest="all"/>
 <copyField source="tags" dest="all"/>
 <copyField source="directors" dest="all"/>
 <copyField source="actors" dest="all"/>

</schema>
