<?xml version="1.0" encoding="utf-8"?>
<test>
<name>specials vs charset_table vs match_mode</name>
<config>
indexer
{
	mem_limit			= 16M
}

searchd
{
	<searchd_settings/>
	workers = threads
}

source src
{
	type			= mysql
	<sql_settings/>
	sql_query		= SELECT * FROM test_table WHERE document_id IN (1,2,3,4)
}

index main
{
	source			= src
	path			= <data_path/>/main
	charset_table	= 0..9, A..Z->a..z, _, a..z, (, ), $
}

source src_wf
{
	type			= mysql
	<sql_settings/>
	sql_query		= SELECT * FROM test_table WHERE document_id>4
}

index wf1
{
	source			= src_wf
	path			= <data_path/>/wf1
	morphology			= stem_en
	charset_table	= 0..9, A..Z->a..z, a..z,
	wordforms = <this_test/>/wordforms.txt
}

index wf2
{
	source			= src_wf
	path			= <data_path/>/wf2
	morphology			= stem_en
	charset_table	= 0..9, A..Z->a..z, a..z, -
	wordforms = <this_test/>/wordforms.txt
}

source src_wf3
{
	type			= mysql
	<sql_settings/>
	sql_query		= SELECT * FROM test_wf3
}


index wf3
{
	source			= src_wf3
	path			= <data_path/>/wf3
	morphology			= stem_en
	charset_table 	= -, 0..9, A..Z->a..z, _, a..z
	wordforms = <this_test/>/wf3.txt
}

index rt
{
	type = rt
	path			= <data_path/>/rt0
	rt_mem_limit = 32M
	rt_field = title
	rt_attr_uint=gid
	dict = keywords
	min_prefix_len = 1
	morphology = stem_en
	index_exact_words = 1
}

index exact_wf
{
	source			= src_wf3
	path			= <data_path/>/exact_wf
	dict = crc
	min_prefix_len = 1
	morphology = stem_en
	index_exact_words = 1
}

source src_cht
{
	type			= mysql
	<sql_settings/>
	sql_query		= SELECT 1, 'Й Ц У К Е Н Г Ш Щ З Х139Ъ' UNION SELECT 2, 'Ф Ы В А П Р О Л Д Ж Э' UNION SELECT 3, 'Я Ч С М И Т Ь Б Ю Ё' UNION SELECT 11, 'й ц у к е н г ш щ з х ъ' UNION SELECT 12, 'ф ы в а п р о л д ж э' UNION SELECT 13, 'я086ч с м и т ь б ю ё' UNION SELECT 101, 'Q W E R T Y U I O P' UNION SELECT 102, 'A S D F G H J K L' UNION SELECT 103, 'Z X C V B N_M' UNION  SELECT 111, 'q w e r t y u i o p' UNION SELECT 112, 'a_s d f g h j k l' UNION SELECT 113, 'z x c v b n m'
}

index cht
{
	source			= src_cht
	path			= <data_path/>/cht
	charset_table 	= english, _, 0..9, russian
}

</config>

<queries>
<query index='main'>google$com</query>
<query index='main' mode="any">foo(bar)</query>
<query index='main' mode="any">foo\(bar\)</query>
<query index='main' mode="extended2">google$com</query>
<query index='main' mode="extended2">foo(bar)</query>
<query index='main' mode="extended2">foo\(bar\)</query>
<query index='main' mode="extended2">"foo(bar)"</query>
<query index='main' mode="extended2">(bars all$)</query>
<query index='wf1' mode="extended2">without trouble$</query>
<query index='wf1' mode="extended2">trouble without$</query>
<query index='wf1' mode="extended2">(trouble without$)</query>
<!-- here is going regression (query 8-)  when second index shares wordform from 1st index -->
<query index='wf1' mode="extended2">run</query>
<query index='wf2' mode="extended2">run</query>
<query index='wf1' mode="extended2">run\-time</query>
<query index='wf2' mode="extended2">run\-time</query>
<query index='wf1' mode="extended2">run time</query>
<query index='wf2' mode="extended2">run time</query>
<!-- charset alias -->
<query index='cht' mode="extended2">Й Ц У К Е Н Г Ш Щ З Х139Ъ</query>
<query index='cht' mode="extended2">й ц у к е н г ш щ з х ъ</query>
<query index='cht' mode="extended2">Ф Ы В А П Р О Л Д Ж Э</query>
<query index='cht' mode="extended2">Я Ч С М И Т Ь Б Ю Ё</query>
<query index='cht' mode="extended2">я086ч с м и т ь б ю ё</query>
<query index='cht' mode="extended2">Q W E R T Y U I O P</query>
<query index='cht' mode="extended2">A S D F G H J K L</query>
<query index='cht' mode="extended2">a_s d f g h j k l</query>
<query index='cht' mode="extended2">Z X C V B N_M</query>
<query index='cht' mode="extended2">z x c v b n m</query>
</queries>
<sphqueries>
<sphinxql>CALL KEYWORDS ('run-time (run time) issue', 'wf1')</sphinxql>
<sphinxql>CALL KEYWORDS ('run-time (run time) issue', 'wf2')</sphinxql>
<!-- here is going regression crash on indexing wordforms vs multi-wordforms -->
<sphinxql>SELECT * from wf3 where match ('word2word2')</sphinxql>
<!-- here is going regression crash on CALL KEYWORDS to RT index with dict keywords -->
<sphinxql>INSERT INTO rt VALUES ( 1, 'dummy', 100 )</sphinxql>
<sphinxql>CALL KEYWORDS ('runs runs* =runs', 'rt', 1)</sphinxql>
<sphinxql>CALL KEYWORDS ('runs runs* =runs', 'exact_wf', 1)</sphinxql>
</sphqueries>


<db_create>
CREATE TABLE test_table (
	document_id INTEGER NOT NULL PRIMARY KEY,
	title VARCHAR(255) NOT NULL )
</db_create>
<db_create>
CREATE TABLE test_wf3 (
	document_id INTEGER NOT NULL PRIMARY KEY,
	title VARCHAR(255) NOT NULL )
</db_create>
<db_drop>
DROP TABLE IF EXISTS test_table
</db_drop>
<db_drop>
DROP TABLE IF EXISTS test_wf3
</db_drop>
<db_insert>
INSERT INTO test_table VALUES
	( 1, 'google dot com' ),
	( 2, 'foo beyond all bars' ),
	( 3, 'mangled google$com link' ),
	( 4, 'no idea why search for foo(bar), but they do' ),
	( 5, 'run-time error' ),
	( 6, 'running without trouble' )
</db_insert>
<db_insert>
INSERT INTO test_wf3 VALUES
	( 1, 'word2word2 word4word4' )
</db_insert>
</test>
