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

<test>

<name>snippets vs query highlighting</name>

<config>
indexer
{
	mem_limit = 16M
}

searchd
{
	<searchd_settings/>
}

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

index test
{
	source = test
	path = <data_path/>/test
	charset_type = utf-8

	phrase_boundary = U+002C
	phrase_boundary_step = 100
}
</config>

<db_insert>select 1;</db_insert>

<custom_test><![CDATA[

$opts = array
(
	'before_match' => '[B]',
	'after_match' => '[A]',
	'chunk_separator' => ' ... ',
	'limit' => 255,
	'around' => 2,
	'query_mode' => 1
);

$text = 'Sphinx clusters scale to billions of documents, terabytes of data, and billions of queries per month.';

$queries = array
(
	'^sphinx month$',
	'^sphinx queries$',
	'^clusters month$',
	'^*inx *bytes',
	'*i*',
	'*on*',
	'*s',
	'"clusters scale"',
	'"clusters do not scale"', // false claims don't get highlighted
	'"of d*"',
	'terabyte* << quer*',
	'data << terabyte*',
	'"sphinx scale"~3',
	'"sphinx billions"~3',
	'"silly documents"/1',
	'"clusters scale to billions"',
	'"queries per month" | month | "per month"',
	'"of d*" | "of data"',
	'"of data" -"of hedgedogs"',
	'"documents terabytes"', // crosses boundary
	'@title sphinx',
	'@text sphinx',
	'@text[3] sphinx',
	'@text[3] documents',
	'@text[7] documents',

	// case shouldn't matter
	'SPHINX',
	'SPH*',
	'*PHI*',
	'*INX',
);

$results = array();
foreach ( $queries as $query )
{
	$reply = $client->BuildExcerpts ( array($text), 'test', $query, $opts );
	$results [] = $query;
	$results [] = $reply;
}

]]></custom_test>

</test>
