<?xml version="1.0" encoding="UTF-8" ?>
<!--
	The schema name property is constructed as follows

	tx_meilisearch		- The extension key
	x-y-z		- The extension version this schema is meant to work with
	YYYYMMDD	- The date the schema file was changed the last time

	When changing the schema the name property must be updated. There is a
	status report - tx_meilisearch_report_SchemaStatus - checking against this
	name property, that status check must be updated as well.
-->
<schema name="tx_meilisearch-11-0-0--20200415" version="1.6" >
	<!-- attribute "name" is the name of this schema and is only used for display purposes.
		Applications should change this to reflect the nature of the search collection.
		version="1.4" is Meilisearch's version number for the schema syntax and semantics.  It should
		not normally be changed by applications.
		1.0: multiValued attribute did not exist, all fields are multiValued by nature
		1.1: multiValued attribute introduced, false by default
		1.2: omitTermFreqAndPositions attribute introduced, true by default except for text fields.
		1.3: removed optional field compress feature
		1.4: default auto-phrase (QueryParser feature) to off
		1.5: omitNorms defaults to true for primitive field types (int, float, boolean, string...)
		1.6: useDocValuesAsStored defaults to true.
	-->

	<uniqueKey>id</uniqueKey>

	<!-- xinclude fields -->
	<xi:include href="../general_schema_types.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>

	<!--  xinclude fields-->
	<xi:include href="../general_schema_fields.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>

	<!-- Language-sensitive string field allowing proper sorting -->
	<fieldType name="string_collated" class="meilisearch.ICUCollationField" locale="hu" strength="primary" />

	<!-- A text field that uses WordDelimiterFilter to enable splitting and matching of
		words on case-change, alpha numeric boundaries, and non-alphanumeric chars,
		so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi".
		Synonyms and stopwords are customized by external files, and stemming is enabled.
		Duplicate tokens at the same position (which may result from Stemmed Synonyms or
		WordDelim parts) are removed.
	-->
	<fieldType name="text" class="meilisearch.TextField" positionIncrementGap="100">
		<analyzer type="index">
			<tokenizer class="meilisearch.WhitespaceTokenizerFactory"/>

			<filter class="meilisearch.WordDelimiterGraphFilterFactory"
				generateWordParts="1" generateNumberParts="1"
				catenateWords="1"
				catenateNumbers="1"
				catenateAll="0"
				splitOnCaseChange="1"
				preserveOriginal="1"
				protected="hungarian/protwords.txt"
			/>
			<filter class="meilisearch.LowerCaseFilterFactory"/>

			<filter class="meilisearch.ManagedSynonymGraphFilterFactory" managed="hungarian" />
			<filter class="meilisearch.FlattenGraphFilterFactory"/>
			<filter class="meilisearch.ManagedStopFilterFactory" managed="hungarian"/>

			<filter class="meilisearch.SnowballPorterFilterFactory" language="Hungarian" protected="hungarian/protwords.txt"/>
			<filter class="meilisearch.RemoveDuplicatesTokenFilterFactory"/>
		</analyzer>
		<analyzer type="query">
			<tokenizer class="meilisearch.WhitespaceTokenizerFactory"/>
			<filter class="meilisearch.WordDelimiterGraphFilterFactory"
				generateWordParts="1"
				generateNumberParts="1"
				catenateWords="0"
				catenateNumbers="0"
				catenateAll="0"
				splitOnCaseChange="1"
				preserveOriginal="1"
				protected="hungarian/protwords.txt"
			/>
			<filter class="meilisearch.LowerCaseFilterFactory"/>

			<filter class="meilisearch.ManagedSynonymGraphFilterFactory" managed="hungarian" />
			<filter class="meilisearch.ManagedStopFilterFactory" managed="hungarian"/>

			<filter class="meilisearch.SnowballPorterFilterFactory" language="Hungarian" protected="hungarian/protwords.txt"/>
			<filter class="meilisearch.RemoveDuplicatesTokenFilterFactory"/>
		</analyzer>
	</fieldType>


	<!-- Less flexible matching, but less false matches.	Probably not ideal for product names,
		but may be good for SKUs.	Can insert dashes in the wrong place and still match. -->
	<fieldType name="textTight" class="meilisearch.TextField" positionIncrementGap="100" >
		<analyzer type="index">
			<tokenizer class="meilisearch.WhitespaceTokenizerFactory"/>

			<filter class="meilisearch.LowerCaseFilterFactory"/>

			<filter class="meilisearch.ManagedSynonymGraphFilterFactory" managed="hungarian" />
			<filter class="meilisearch.FlattenGraphFilterFactory"/>
			<filter class="meilisearch.ManagedStopFilterFactory" managed="hungarian"/>

			<filter class="meilisearch.WordDelimiterGraphFilterFactory"
				generateWordParts="0"
				generateNumberParts="0"
				catenateWords="1"
				catenateNumbers="1"
				catenateAll="0"
				preserveOriginal="1"
				protected="hungarian/protwords.txt"
			/>
			<filter class="meilisearch.FlattenGraphFilterFactory"/>

			<filter class="meilisearch.SnowballPorterFilterFactory" language="Hungarian" protected="hungarian/protwords.txt"/>
			<filter class="meilisearch.RemoveDuplicatesTokenFilterFactory"/>
		</analyzer>
		<analyzer type="query">
			<tokenizer class="meilisearch.WhitespaceTokenizerFactory"/>

			<filter class="meilisearch.LowerCaseFilterFactory"/>

			<filter class="meilisearch.ManagedSynonymGraphFilterFactory" managed="hungarian" />
			<filter class="meilisearch.ManagedStopFilterFactory" managed="hungarian"/>

			<filter class="meilisearch.WordDelimiterGraphFilterFactory"
					generateWordParts="0"
					generateNumberParts="0"
					catenateWords="1"
					catenateNumbers="1"
					catenateAll="0"
					preserveOriginal="1"
					protected="hungarian/protwords.txt"
			/>
			<filter class="meilisearch.SnowballPorterFilterFactory" language="Hungarian" protected="hungarian/protwords.txt"/>
			<filter class="meilisearch.RemoveDuplicatesTokenFilterFactory"/>
		</analyzer>
	</fieldType>

	<!-- Exact matching of words like textWhiteSpaceTokenized,
		but with enabled Synonym and Stop Filter
	 -->
	<fieldType name="textExact" class="meilisearch.TextField" positionIncrementGap="100" >
		<analyzer type="query">
			<tokenizer class="meilisearch.WhitespaceTokenizerFactory"/>

			<filter class="meilisearch.LowerCaseFilterFactory"/>
			<filter class="meilisearch.ManagedSynonymGraphFilterFactory" managed="hungarian" />
			<filter class="meilisearch.FlattenGraphFilterFactory"/>
			<filter class="meilisearch.ManagedStopFilterFactory" managed="hungarian"/>
			<filter class="meilisearch.RemoveDuplicatesTokenFilterFactory"/>
		</analyzer>
		<analyzer type="index">
			<tokenizer class="meilisearch.WhitespaceTokenizerFactory"/>

			<filter class="meilisearch.LowerCaseFilterFactory"/>
			<filter class="meilisearch.ManagedSynonymGraphFilterFactory" managed="hungarian" />
			<filter class="meilisearch.ManagedStopFilterFactory" managed="hungarian"/>
			<filter class="meilisearch.RemoveDuplicatesTokenFilterFactory"/>
		</analyzer>
	</fieldType>

	<!-- Setup simple analysis for spell checking -->
	<fieldType name="textSpell" class="meilisearch.TextField" positionIncrementGap="100" omitNorms="true">
		<analyzer type="index">
			<tokenizer class="meilisearch.StandardTokenizerFactory"/>

			<filter class="meilisearch.LowerCaseFilterFactory"/>

			<filter class="meilisearch.ManagedStopFilterFactory" managed="hungarian"/>

			<filter class="meilisearch.RemoveDuplicatesTokenFilterFactory"/>
		</analyzer>
		<analyzer type="query">
			<tokenizer class="meilisearch.StandardTokenizerFactory" />

			<filter class="meilisearch.LowerCaseFilterFactory"/>

			<filter class="meilisearch.ManagedSynonymGraphFilterFactory" managed="hungarian" />
			<filter class="meilisearch.ManagedStopFilterFactory" managed="hungarian"/>

			<filter class="meilisearch.RemoveDuplicatesTokenFilterFactory"/>
		</analyzer>
	</fieldType>

</schema>
