<test>
<name>before operator</name>

<config>
indexer
{
	mem_limit = 16M
}

searchd
{
	<searchd_settings/>
}

source test
{
	type = mysql
	<sql_settings/>
	sql_query = SELECT * FROM test_table where document_id in (1,2,3,4,5 )
}

index test
{
	source	= test
	path	= <data_path/>/test
	min_word_len = 1
}

source test1
{
	type = mysql
	<sql_settings/>
	sql_query = SELECT * FROM test_table where document_id=6
}

index test1
{
	source	= test1
	path	= <data_path/>/test1
}

source test2
{
	type = mysql
	<sql_settings/>
	sql_query = SELECT * FROM test_table where document_id in ( 10, 11, 12, 13, 14, 15 )
}

index test2
{
	source	= test2
	path	= <data_path/>/test2
}

</config>

<db_create>
CREATE TABLE test_table
(
	document_id INT NOT NULL,
	title VARCHAR(255) NOT NULL,
	text VARCHAR(4096) NOT NULL
);
</db_create>

<db_drop>
DROP TABLE IF EXISTS test_table;
</db_drop>

<db_insert>
INSERT INTO test_table ( document_id, title, text ) VALUES
( 1, 'aaa bbb', 'ccc ddd' ),
( 2, 'xxx', 'ccc ddd eee fff ggg' ),
( 3, 'yyy', 'one one one two three' ),
( 4, 'zzz', 'one two three one three one two four one two three four' ),
( 5, '', 'a b c d e f g' ),
( 6, '', 'h1 h2 h3 h4 h5' ),
( 10, '', 'hi' ),
( 11, '', 'hi' ),
( 12, '', 'zi' ),
( 13, '', CONCAT(REPEAT('vi mi ', 530), ' vi mi hi' ) ),
( 14, '', 'vi mi' ),
( 15, '', 'lo' );
</db_insert>

<queries>
	<query mode="extended2"><![CDATA[ aaa << ccc ]]></query>
	<query mode="extended2"><![CDATA[ aaa << bbb << ccc ]]></query>
	<query mode="extended2"><![CDATA[ aaa << ccc << ddd ]]></query>
	<query mode="extended2"><![CDATA[ ccc << ddd ]]></query>
	<query mode="extended2"><![CDATA[ ccc << eee << fff ]]></query>
	<query mode="extended2"><![CDATA[ ccc << ddd << ggg ]]></query>
	<query mode="extended2"><![CDATA[ ccc << ddd << xxx ]]></query>	
	<query mode="extended2"><![CDATA[ eee << ddd << ggg ]]></query>

	<query mode="extended2"><![CDATA[ one << two << three ]]></query>
	<query mode="extended2"><![CDATA[ one << three ]]></query>
	<query mode="extended2"><![CDATA[ one << one << three ]]></query>
	<query mode="extended2"><![CDATA[ one << one << one << three ]]></query>
	<query mode="extended2"><![CDATA[ one << one << one << one << three ]]></query>
	<query mode="extended2"><![CDATA[ one << two << three << four ]]></query>

	<query mode="extended2"><![CDATA[ "a b c" << b << c << d ]]></query>
	<query mode="extended2"><![CDATA[ "a b c" << c << d << e ]]></query>
	<query mode="extended2"><![CDATA[ "a b c" << e << f << g ]]></query>
	<query mode="extended2"><![CDATA[ a << "b c d" << e ]]></query>
	<query mode="extended2"><![CDATA[ "a b c d" << "d e f" ]]></query>
	<query mode="extended2"><![CDATA[ "a b c d" << "e f g" ]]></query>

	<query mode="extended2"><![CDATA[ (ccc | "ddd eee") << (ddd | ggg) ]]></query>
	<query mode="extended2"><![CDATA[ ccc << ddd$ ]]></query>
	<query mode="extended2"><![CDATA[ ^one << two << three$ ]]></query>
	<query mode="extended2"><![CDATA[ ^one << "one one" << two << three$ ]]></query>
	<query mode="extended2"><![CDATA[ "zzz aaa"/1 << bbb ]]></query>
	<query mode="extended2"><![CDATA[ "zzz aaa"/1 << ddd ]]></query>
	<!-- here is going regression -->
	<query mode="extended2" index="test1"><![CDATA[ ("h1 h2" NEAR/5 ( h3 | h4 | h5) ) << ("h1 h2" NEAR/5 ( h3 | h4 | h5) ) ]]></query>
</queries>

<sphqueries>
<sphinxql><![CDATA[ select * from test2 where match ( ' hi | ( vi << mi )' ) and id in ( 10, 11, 12, 15 ) ]]></sphinxql>
</sphqueries>

</test>
