1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
<?xml version="1.0" encoding="utf-8"?>
<test>
<name>RECONFIGURE in RT indexes</name>
<requires></requires>
<config>
searchd
{
<searchd_settings/>
binlog_path =
workers = threads
}
index rt1
{
type = rt
path = <data_path/>/rt1
charset_table = a..z, _, A..Z->a..z
dict = keywords
rt_field = name
rt_attr_uint = idd
morphology = stem_en
wordforms = <this_test/>/wf1.txt
}
source src_dummy
{
type = mysql
<sql_settings/>
sql_query = SELECT id, gid, text FROM test_table
sql_attr_uint = gid
}
index test_dummy
{
source = src_dummy
path = <data_path/>/test_dummy
}
</config>
<db_drop>drop table if exists test_table</db_drop>
<db_create>
create table test_table
(
id int not null,
text varchar(255) not null,
gid int
);
</db_create>
<db_insert>
insert into test_table values ( 1, 'first', 1 )
</db_insert>
<custom_test><![CDATA[
$results = array();
$ql->Reconnect();
$results[] = 'initial commit';
$results[] = "\n" . $ql->Query ( "REPLACE INTO rt1 (id, name, idd) VALUES (1, 'TOFU', 1)" );
$results[] = 'query SOY';
$results[] = "\n" . $ql->Query ( "SELECT * FROM rt1 WHERE MATCH ( 'SOY' )" );
$results[] = 'query TOFU';
$results[] = "\n" . $ql->Query ( "SELECT * FROM rt1 WHERE MATCH ( 'TOFU' )" );
$orig_conf = file('config.conf');
$new_conf = '';
foreach ( $orig_conf as $line )
{
if ( strstr ( $line, 'wordforms' ) )
{
$line = '#' . $line;
}
$new_conf .= $line;
}
file_put_contents('config.conf', $new_conf);
$results[] = "\n" . $ql->Query ( "ALTER RTINDEX rt1 RECONFIGURE" );
$results[] = 'add 2nd doc';
$results[] = "\n" . $ql->Query ( "REPLACE INTO rt1 (id, name, idd) VALUES (2, 'TOFU', 1)" );
$results[] = 'query SOY';
$results[] = "\n" . $ql->Query ( "SELECT * FROM rt1 WHERE MATCH ( 'SOY' )" );
$results[] = 'query TOFU';
$results[] = "\n" . $ql->Query ( "SELECT * FROM rt1 WHERE MATCH ( 'TOFU' )" );
$results[] = 'replace 1st doc';
$results[] = "\n" . $ql->Query ( "REPLACE INTO rt1 (id, name, idd) VALUES (1, 'TOFU', 1)" );
$results[] = 'query SOY';
$results[] = "\n" . $ql->Query ( "SELECT * FROM rt1 WHERE MATCH ( 'SOY' )" );
$results[] = 'query TOFU';
$results[] = "\n" . $ql->Query ( "SELECT * FROM rt1 WHERE MATCH ( 'TOFU' )" );
]]></custom_test>
</test>
|