<?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 configuration file has been created for EDEAL CRM software
 
 If you need an introduction to solr features or configuration you may take a look at
 http://www.ibm.com/developerworks/java/library/j-solr1/
 
 See also schema-example.xml for full commented schema file.
 Solr wiki can be found at http://wiki.apache.org/solr/
 ================================================================================
-->

<schema name="edeal" version="1.1">
  <types>
    <fieldType name="string" class="org.apache.solr.schema.StrField" sortMissingLast="true" omitNorms="true"/>
    <fieldType name="boolean" class="org.apache.solr.schema.BoolField" sortMissingLast="true" omitNorms="true"/>
    <fieldType name="text" class="org.apache.solr.schema.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="org.apache.solr.analysis.WhitespaceTokenizerFactory"/>
        <!--  <filter class="org.apache.solr.analysis.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>-->
        <filter class="org.apache.solr.analysis.WordDelimiterFilterFactory"	generateWordParts="1"	generateNumberParts="1"	catenateWords="1"	catenateNumbers="1"	catenateAll="0"	splitOnCaseChange="1"/>
        <filter class="org.apache.solr.analysis.LowerCaseFilterFactory"/>
		<filter class="org.apache.solr.analysis.ISOLatin1AccentFilterFactory"/>
        <filter class="org.apache.solr.analysis.SnowballPorterFilterFactory" language="French"/>
        <filter class="org.apache.solr.analysis.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="org.apache.solr.analysis.WhitespaceTokenizerFactory"/>
        <!--<filter class="org.apache.solr.analysis.SynonymFilterFactory"	synonyms="synonyms.txt"	ignoreCase="true"	expand="true"/>
         <filter class="org.apache.solr.analysis.StopFilterFactory" ignoreCase="true"	words="stopwords.txt"/>-->
        <filter class="org.apache.solr.analysis.WordDelimiterFilterFactory"	generateWordParts="1"	generateNumberParts="1"	catenateWords="0"	catenateNumbers="0"	catenateAll="0"	splitOnCaseChange="1"/>
        <filter class="org.apache.solr.analysis.LowerCaseFilterFactory"/> 
		<filter class="org.apache.solr.analysis.ISOLatin1AccentFilterFactory"/>
        <filter class="org.apache.solr.analysis.SnowballPorterFilterFactory" language="French"/>
        <filter class="org.apache.solr.analysis.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
    </fieldType>
    <fieldType name="textSpell" class="org.apache.solr.schema.TextField" positionIncrementGap="100" >
      <analyzer>
        <tokenizer class="org.apache.solr.analysis.StandardTokenizerFactory"/>
        <filter class="org.apache.solr.analysis.LowerCaseFilterFactory"/>
		<filter class="org.apache.solr.analysis.ISOLatin1AccentFilterFactory"/>
        <filter class="org.apache.solr.analysis.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
    </fieldType>
    <fieldType name="date" class="org.apache.solr.schema.DateField" omitNorms="true"/>
    <fieldType name="blob" class="org.apache.solr.schema.ByteField" omitNorms="true"/>
    <fieldtype name="ignored" stored="false" indexed="false" class="org.apache.solr.schema.StrField" /> 
 </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="id" type="string" indexed="true" stored="true" required="true" />
   <field name="title" type="text" indexed="true" stored="true"/>
   <field name="prim" type="text" indexed="true" stored="false" multiValued="true"/>
   <field name="sec" type="text" indexed="true" stored="false" multiValued="true"/>
   <field name="embedded" type="text" indexed="true" stored="false" multiValued="true"/>
   <field name="spell" type="textSpell" indexed="true" stored="false" multiValued="true"/>
   <field name="date" type="date" indexed="true" stored="false" />
   <field name="all" type="text" indexed="true" stored="true" multiValued="true"/>
   <field name="last_modified" type="ignored"/>
   <field name="meta_object" type="string" indexed="true" stored="true" />
   
   <dynamicField name="facet_*" type="string" indexed="true" stored="false" omitNorms="true"/>
   <dynamicField name="meta_*" type="string" indexed="false" stored="true" />
   
 </fields>

 <uniqueKey>id</uniqueKey>

 <defaultSearchField>all</defaultSearchField>

 <solrQueryParser defaultOperator="AND"/>

 <!-- Copy Fields -->
 <copyField source="title" dest="prim"/>
 
 <copyField source="title" dest="all"/>
 <copyField source="prim" dest="all"/>
 <copyField source="sec" dest="all"/>
 <copyField source="embedded" dest="all"/>
 <copyField source="facet_*" dest="all"/>
 
 <copyField source="title" dest="spell"/>
 <copyField source="prim" dest="spell"/>
 <copyField source="sec" dest="spell"/>
 <copyField source="meta_object" dest="spell"/>
 <copyField source="facet_*" dest="spell"/>
 
</schema>
