<?xml version="1.0" encoding="UTF-8" ?>
<schema name="example" version="1.5">

<!-- SOLR schema definition get data from MySQL index
 <br/><br/>
 @author Patricia Kelber, Gabriele Droege, (BGBM, GGBN/DNA Bank Network) <contact@dnabank-network.org>
 @version 1.0
 @package SOLR indexing
 @copyright Copyright © 2014 GGBN http://www.ggbn.org
 <br/>The contents of this file are subject to the Mozilla Public License Version 1.1
 @filesource
 @license http://www.mozilla.org/MPL/ MPL
-->

	<!-- """"""""""""""""""""""" type definitions """"""""""""""""""""""" -->

	<types>
		<fieldType name="string" class="solr.StrField"
			sortMissingLast="true" />
		<fieldType name="int" class="solr.TrieIntField"
			precisionStep="0" positionIncrementGap="0" />
		<fieldType name="tdate" class="solr.TrieDateField"
			precisionStep="6" positionIncrementGap="0" />
		<fieldType name="tint" class="solr.TrieIntField"
			precisionStep="8" positionIncrementGap="0" />
		<fieldType name="tfloat" class="solr.TrieFloatField"
			precisionStep="8" positionIncrementGap="0" />
		<fieldType name="long" class="solr.TrieLongField"
			precisionStep="0" positionIncrementGap="0" />
		<fieldType name="tdouble" class="solr.TrieDoubleField"
			precisionStep="8" positionIncrementGap="0" />
		<!-- Goe coordinates -->
		<!-- Old solr 3 based field type. Depricated and not used in this schema 
			<fieldType name="location_solr3" class="solr.LatLonType" subFieldSuffix="_coordinate"/> -->
		<fieldType name="location" class="solr.SpatialRecursivePrefixTreeFieldType"
			units="degrees" />

		<fieldType name="text_simple_general" class="solr.TextField">
			<analyzer type="index">
				<tokenizer class="solr.StandardTokenizerFactory" />
				<filter class="solr.LowerCaseFilterFactory" />
			</analyzer>
			
			<analyzer type="query">
				<tokenizer class="solr.StandardTokenizerFactory" />
				<filter class="solr.LowerCaseFilterFactory" />
			</analyzer>
		</fieldType>
		
		<!-- a type similar to string but case insensitiv -->
		<fieldType name="string_case_i" class="solr.StrField" sortMissingLast="true">
			<filter class="solr.LowerCaseFilterFactory" />
			</fieldType>
		<!-- Sybille class="solr.TextField" >-->
		<!-- Sybille	<analyzer type="index">
				<tokenizer class="solr.KeywordTokenizerFactory" />
		<filter class="solr.LowerCaseFilterFactory" />
				<filter class="solr.EdgeNGramFilterFactory" minGramSize="2"
					maxGramSize="50" /> 
			</analyzer>
			

			<analyzer type="query">
				<tokenizer class="solr.KeywordTokenizerFactory" />
				<filter class="solr.LowerCaseFilterFactory" />
			</analyzer> -->

		
		<fieldType name="text_ws_case_i" class="solr.TextField"
			positionIncrementGap="100">
			<analyzer>
				<tokenizer class="solr.WhitespaceTokenizerFactory" />
				<filter class="solr.LowerCaseFilterFactory" />
			</analyzer>
		</fieldType>
		

		<!-- If polygone support is neededn, add spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory" 
			See http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4 -->



		<!-- 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" enablePositionIncrements="true" />
				<!-- in this example, we will only use synonyms at query time <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" enablePositionIncrements="true" />
				<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
					ignoreCase="true" expand="true" />
				<!--<filter class="solr.SynonymFilterFactory" synonyms="synonyms_animals_common_names_de_en.txt" 
					ignoreCase="true" expand="true"/><filter class="solr.SynonymFilterFactory" 
					synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <filter class="solr.SynonymFilterFactory" 
					synonyms="synonyms_plants_common_names_de_en.txt" ignoreCase="true" expand="true"/> 
					<filter class="solr.LowerCaseFilterFactory"/> -->
			</analyzer>
		</fieldType>

		<!-- 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>
	</types>

	<!-- """"""""""""""""""""""" fields """"""""""""""""""""""" -->

	<fields>
		<field name="_version_" type="long" indexed="true" stored="true" />

		<field name="familyName" type="text_ws_case_i" indexed="true"
			stored="true" />
		<field name="familyName_suggest" type="string_case_i" indexed="true"
			stored="true" />
		<copyField source="familyName" dest="familyName_suggest" />

		<field name="orderName" type="text_ws_case_i" indexed="true"
			stored="true" />
		<field name="orderName_suggest" type="string_case_i" indexed="true"
			stored="true" />
		<copyField source="orderName" dest="orderName_suggest" />

		<field name="className" type="text_ws_case_i" indexed="true"
			stored="true" />
		<field name="className_suggest" type="string_case_i" indexed="true"
			stored="true" />
		<copyField source="className" dest="className_suggest" />

		<field name="phylumName" type="text_ws_case_i" indexed="true"
			stored="true" />
		<field name="phylumName_suggest" type="string_case_i" indexed="true"
			stored="true" />
		<copyField source="phylumName" dest="phylumName_suggest" />

		<field name="kingdomName" type="text_ws_case_i" indexed="true"
			stored="true" />
		<field name="kingdomName_suggest" type="string_case_i" indexed="true"
			stored="true" />
		<copyField source="kingdomName" dest="kingdomName_suggest" /> <!-- Gabis Version	-->


	<field name="fullScientificName" type="text_ws_case_i" indexed="true" stored="true" />
	<field name="fullScientificName_suggest" type="string_case_i" indexed="true" stored="true" multiValued="true"/> 
		<copyField source="fullScientificName" dest="fullScientificName_suggest" />

		<!-- fields for dropdown field of all possible choices have type string 
			to keep original values -->

		<field name="country" type="string" indexed="true"  multiValued="true" />
		<field name="countryL" type="string" indexed="true"  stored="true" />
		<copyField source="countryL" dest="country" />	
		
		<field name="isocountrycode" type="string" indexed="true" multiValued="true" />
		<field name="isocountrycodeL" type="string" indexed="true" stored="true"  />
		<copyField source="isocountrycodeL" dest="isocountrycode" />	

		<field name="ocean" type="string" indexed="true" stored="true" multiValued="true"/>

		<field name="continent" type="string" indexed="true" stored="true" multiValued="true"/>
		
		<field name="sea" type="string" indexed="true"  multiValued="true"/>
		<field name="seaL" type="string" indexed="true" stored="true"  />
		<copyField source="seaL" dest="sea" />
		
		<field name="institution" type="string" indexed="true"  multiValued="true" />	
		<field name="institutionL" type="string" indexed="true" stored="true"  />
		<copyField source="institutionL" dest="institution" />
		
		<!-- text field with "from" and "to" that means * we query if the index 
			field is in between the 2 values from the form (with yii (server side) validation -->
		<field name="latitude" type="tdouble" indexed="true" stored="true" multiValued="true" />
		<field name="longitude" type="tdouble" indexed="true" stored="true" multiValued="true" />
		<field name="rawlongitude" type="string" indexed="true" stored="true" multiValued="true" />
		<field name="gatheringyear" type="text_simple_general" indexed="true"  multiValued="true"/>
		<field name="gatheringyearL" type="text_simple_general" indexed="true" stored="true"  />
		<copyField source="gatheringyearL" dest="gatheringyear" />

		<!-- checkbox fields that get 0 or 1 as input -->
		<field name="hasImage" type="int" indexed="true" stored="true" />
		<field name="hasTypestatus" type="int" indexed="true" stored="true" />

		<!-- simple text fields with free text search -->
		<field name="locality" type="text_simple_general" indexed="true" multiValued="true"/>
		<field name="localityL" type="text_simple_general" indexed="true" stored="true"  />
		<copyField source="localityL" dest="locality" />
		
		<!-- collectors -->
		<field name="collectors" type="text_simple_general" indexed="true"  multiValued="true"/>
		<field name="collectorsL" type="text_simple_general" indexed="true" stored="true"  />
		<copyField source="collectorsL" dest="collectors" />

		<field name="unitID" type="text_simple_general" indexed="true" stored="true" multiValued="true"/>
		<field name="unitIDL" type="text_simple_general" indexed="true" stored="true"  />
		<copyField source="unitIDL" dest="unitID" />

		<field name="associationtype" type="text_simple_general" indexed="true"	stored="true" multiValued="true"/>
		<field name="fk_tripleidstoreid" type="string" indexed="true" stored="true" />
		
		<field name="occurrenceid" type="string" indexed="true" stored="true"/>
	<!--	<field name="occurrenceidL" type="string" indexed="true" stored="true"  />
		<copyField source="occurrenceidL" dest="occurrenceid" />-->
		
		<field name="searchedtripleid" type="string" indexed="true" stored="true"  multiValued="true"/>

		<!-- <field name="specimenNo_extractionNo" type="text_simple_general" indexed="true" 
			stored="true" /> -->


		<!-- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -->
		<field name="accessPoint" type="text_simple_general"  indexed="false" stored="true" multiValued="true"/>
		
		<field name="basedirectory" type="text_simple_general"  indexed="false" stored="true" multiValued="true"/>
		
		<field name="digirresourcename" type="text_simple_general"  indexed="false" stored="true" multiValued="true"/>
		
		<field name="protocolname" type="text_simple_general"  indexed="false" stored="true" multiValued="true"/>
		
		<field name="schemaurl" type="text_simple_general"  indexed="false" stored="true" multiValued="true"/>
		
		<field name="schemaname" type="text_simple_general"  indexed="false" stored="true" multiValued="true"/>
			
		<!-- kindofunit -->
		<field name="kindofunit" type="string" indexed="true"  multiValued="true" />
		<field name="kindofunitL" type="string" indexed="true" stored="true"  />
		<copyField source="kindofunitL" dest="kindofunit" />
		
		<field name="sampletype" type="string" indexed="true"  multiValued="true"/>
		<field name="sampletypeL" type="string" indexed="true" stored="true"  />
		<copyField source="sampletypeL" dest="sampletype" />

<!--		<field name="gatheringdate" type="string" indexed="true" stored="true" /> 
		 <field name="gatheringdatebegin" type="tdate" indexed="true" stored="true"/> 
			<field name="gatheringdateend" type="tdate" indexed="true" stored="true"/> 
		<field name="gatheringdatebegin" type="string" indexed="true"
			stored="true" />
		<field name="gatheringdateend" type="string" indexed="true"
			stored="true" />

		<field name="guid" type="string" indexed="true" stored="true" />

		<field name="minDepth" type="string" indexed="true" stored="true" />
		<field name="maxDepth" type="string" indexed="true" stored="true" />
		<field name="minAltitude" type="string" indexed="true" stored="true" />
		<field name="maxAltitude" type="string" indexed="true" stored="true" />

		<field name="gatheringareas" type="string" indexed="true"
			stored="true" />
		<field name="establishmentMeans" type="string" indexed="false"
			stored="false" />
		<field name="recordURI" type="string" indexed="false" stored="false" />

		<field name="preferred" type="string" indexed="false" stored="false"
			multiValued="true" />
		<field name="genusOrMonomial" type="string" indexed="true"
			stored="true" multiValued="true" />
		<field name="specificepithet" type="string" indexed="true"
			stored="true" multiValued="true" />
		<field name="infraspecificepithet" type="string" indexed="true"
			stored="true" multiValued="true" />
		<field name="infragenericepithet" type="string" indexed="true"
			stored="true" multiValued="true" />
		<field name="canonicalName" type="string" indexed="true" stored="true"
			multiValued="true" />
		<field name="authorstring" type="string" indexed="true" stored="true"
			multiValued="true" />
		<field name="authoryearint" type="string" indexed="true" stored="true"
			multiValued="true" />   -->


		<field name="collectioncode" type="string" indexed="true"  multiValued="true"/>
		<field name="collectioncodeL" type="string" indexed="true" stored="true"  />
		<copyField source="collectioncodeL" dest="collectioncode" />
		
		<field name="institutioncode" type="string" indexed="true"  multiValued="true"/>
		<field name="institutioncodeL" type="string" indexed="true" stored="true"  />
		<copyField source="institutioncodeL" dest="institutioncode" />
		

		<!-- recordbasis -->
		<field name="recordbasis" type="string" indexed="true"  multiValued="true"/>
		<field name="recordbasisL" type="string" indexed="true" stored="true"  />
		<copyField source="recordbasisL" dest="recordbasis" />

		<!-- collectorNUMBER -->
		<field name="collectornumber" type="string" indexed="true"  multiValued="true"/>
		<field name="collectornumberL" type="string" indexed="true" stored="true"  />
		<copyField source="collectornumberL" dest="collectornumber" />

		<!-- fieldnumber -->
		<field name="fieldnumber" type="string" indexed="true"  multiValued="true"/>
		<field name="fieldnumberL" type="string" indexed="true" stored="true"  />
		<copyField source="fieldnumberL" dest="fieldnumber" />

		<!-- unitaccessionnumber -->
		<field name="accessionnumber" type="string_case_i" indexed="true"  multiValued="true" />
		<field name="accessionnumberL" type="string_case_i" indexed="true" stored="true"  />
		<copyField source="accessionnumberL" dest="accessionnumber" />
		
		<!-- sequenceaccession -->
		<field name="geneticlocus" type="string_case_i" indexed="true" stored="true" multiValued="true" />
		<field name="geneticlocus_suggest" type="string_case_i" indexed="true" stored="true" multiValued="true" /> <!-- Gabi:  versuch mit case_i -->
		<copyField source="geneticlocus" dest="geneticlocus_suggest" />	
		<field name="accessionUrl" type="string"  indexed="false" stored="true" multiValued="true" />
		<field name="accessionIdentifier" type="string_case_i" indexed="true" stored="true" multiValued="true" />
		
		<field name="accessionIdentifier_suggest" type="string_case_i" indexed="true" stored="true" multiValued="true" /> <!-- Gabi:  versuch mit case_i -->
		<copyField source="accessionIdentifier" dest="accessionIdentifier_suggest" />

 
		<field name="text" type="text_general" indexed="true" stored="false" multiValued="true" />


	<!--	<field name="typestatus" type="string" indexed="true" stored="true" /> -->

		<field name="absorbance230" type="string"  indexed="false" stored="true" multiValued="true"/>
		<field name="absorbance280" type="string"  indexed="false" stored="true" multiValued="true"/>
		<field name="concentration" type="string"  indexed="false" stored="true" multiValued="true" />  
		<field name="blockedUntil" type="string"  indexed="false" stored="true" multiValued="true"/> 
		<field name="blocked" type="string"  indexed="false" stored="true" multiValued="true"/> 
		<field name="disposition" type="string"  indexed="false" stored="true" multiValued="true"/> 
		<field name="conditions" type="string"  indexed="false" stored="true" multiValued="true"/> 
		
		<field name="preparationDate" type="string"  indexed="false"	stored="true" multiValued="true"/>
		<field name="preparationMethod" type="string"  indexed="false"	stored="true" multiValued="true"/>
		<field name="preparationStaff" type="string"  indexed="false"	stored="true" multiValued="true"/>
		
		<field name="format" type="string"  indexed="false"	stored="true" multiValued="true"/>
		<field name="url" type="string"  indexed="false"	stored="true" multiValued="true"/>
		<field name="copyrights" type="string"  indexed="false"	stored="true" multiValued="true"/>
		<field name="termsofuse" type="string"  indexed="false"	stored="true" multiValued="true"/>
		<field name="licenses" type="string"  indexed="false"	stored="true" multiValued="true"/>


	</fields>

	<uniqueKey>fk_tripleidstoreid</uniqueKey>
	<!-- <defaultSearchField>text</defaultSearchField> -->
	<solrQueryParser defaultOperator="AND" />
	<!-- <uniqueKey>occurrenceid</uniqueKey> -->

	<!-- <copyField source="fullScientificName" dest="text" /> <copyField source="highertaxon" 
		dest="text" /> <copyField source="canonicalName" dest="text" /> <copyField 
		source="specificepithet" dest="text" /> -->
</schema>