<?xml version="1.0" encoding="utf-8"?>

<test>
<name>snippets vs multiwordforms</name>

<config>
searchd
{
	<searchd_settings/>
	workers = threads
	dist_threads = 2
}

source test
{
	type = mysql
	<sql_settings/>
	sql_query = SELECT 1, 'text';
}

index test
{
	source			= test
	path			= <data_path/>/test

	wordforms = <this_test/>/wordforms.txt
	blend_chars = +
}

source src_snip
{
	type			= mysql
	<sql_settings/>

	sql_query		= SELECT 1 as id , 1 as idd, 2 as idd2, 'viva las mundos' as body
	sql_attr_uint = idd
	sql_attr_uint = idd2
	sql_field_string = body
}

index snip2
{
	source			= src_snip
	path			= <data_path/>/snip2
}

source src_snip22
{
	type			= mysql
	<sql_settings/>

	sql_query		= SELECT 100 as id , 1 as idd, 20 as idd2, 'viva las mundos' as body
	sql_attr_uint = idd
	sql_attr_uint = idd2
	sql_field_string = body
}

index snip22
{
	source			= src_snip22
	path			= <data_path/>/snip22
}

source src_snip3
{
	type			= mysql
	<sql_settings/>

	sql_query		= SELECT 10 as id , 1 as idd, 20 as pup, 'viva las mundos' as body
	sql_attr_uint = pup
	sql_attr_uint = idd
	sql_field_string = body
}

index snip3
{
	source			= src_snip3
	path			= <data_path/>/snip3
}

index dist1
{
	type = distributed
	local = snip2
	local = snip3
}

index dist2
{
	type = distributed
	local = snip2
	agent = <my_address/>:snip3
}

index dist3
{
	type = distributed
	agent = <my_address/>:snip2
	agent = <my_address/>:snip3
}

index dist11
{
	type = distributed
	local = snip2
	local = snip22
}

index dist12
{
	type = distributed
	local = snip2
	agent = <my_address/>:snip22
}

index dist13
{
	type = distributed
	agent = <my_address/>:snip2
	agent = <my_address/>:snip22
}
</config>

<db_insert>select 1;</db_insert>

<sphqueries>
<sphinxql>CALL SNIPPETS('Kph on Europe road 1110', 'test', 'kph', 1 AS query_mode )</sphinxql>
<sphinxql>CALL SNIPPETS('when you on+time do it', 'test', 'you on', 1 AS query_mode )</sphinxql>
<sphinxql>CALL SNIPPETS('when you on+time do it', 'test', 'you time', 1 AS query_mode )</sphinxql>
<sphinxql>CALL SNIPPETS('you on+time 0 es you 0 at', 'test', 'none', 1 AS query_mode )</sphinxql>
<sphinxql>CALL SNIPPETS('you on+time 0 es you 0 at', 'test', '0', 1 AS query_mode )</sphinxql>

<!-- regression SNIPPET crash -->
<sphinxql>select id, SNIPPET('', '') as s from snip2 where match ('silver')</sphinxql>
<sphinxql>select id, SNIPPET('body as las void', 'las') as s from snip2 where match ('las')</sphinxql>
<sphinxql>select id, SNIPPET(body, 'las') as s from snip2 where match ('las')</sphinxql>
<sphinxql>select id, SNIPPET('something', snip2) from snip2</sphinxql>

<!-- regression SNIPPET expression from distributed index -->
<sphinxql>select *, SNIPPET('body as las void', 'las') from dist3</sphinxql>
<sphinxql>select *, SNIPPET(body, 'las') from dist3</sphinxql>
<sphinxql>select *, SNIPPET('body as las void', 'las') from dist2</sphinxql>
<sphinxql>select *, SNIPPET(body, 'las') from dist2</sphinxql>
<sphinxql>select *, SNIPPET('body as las void', 'las') from dist1</sphinxql>
<sphinxql>select *, SNIPPET(body, 'las') from dist1</sphinxql>
<sphinxql>select *, SNIPPET(body, 'cas') from dist2</sphinxql>
<sphinxql>select *, SNIPPET(body, 'cas') from dist1</sphinxql>
<sphinxql>select *, SNIPPET(body, 'las') from dist11</sphinxql>
<sphinxql>select *, SNIPPET(body, 'las') from dist12</sphinxql>
<sphinxql>select *, SNIPPET(body, 'las') from dist13</sphinxql>
<sphinxql>select id, body, SNIPPET(body, '','allow_empty=1', 'query_mode=1') from snip2</sphinxql>
<sphinxql>select id, body, SNIPPET(body, '','allow_empty=0', 'query_mode=1') from snip2</sphinxql>

</sphqueries>

</test>
