File: test.xml

package info (click to toggle)
sphinxsearch 2.2.11-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 25,720 kB
  • sloc: cpp: 102,259; xml: 85,608; sh: 9,259; php: 3,790; ansic: 3,158; yacc: 1,969; java: 1,336; ruby: 1,289; python: 1,062; pascal: 912; perl: 381; lex: 275; makefile: 150; sql: 77; cs: 35
file content (126 lines) | stat: -rw-r--r-- 2,230 bytes parent folder | download | duplicates (3)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?xml version="1.0" encoding="utf-8"?>

<test>
<name>re-enable indexes using rotation</name>

<requires><non-rt/></requires>

<config>
searchd
{
	<searchd_settings/>
	binlog_path =
	workers = threads
	<dynamic>
		<variant>
			seamless_rotate = 0
		</variant>
		<variant>
			seamless_rotate = 1
		</variant>
	</dynamic>
}

source sql1
{
	type = mysql
	<sql_settings/>

	sql_query = select id, text, mode from test_table where mode=1
	sql_attr_uint = mode
}

index plain1
{
	source = sql1
	path = <data_path/>/plain1
	docinfo = extern
}

source sql2
{
	type = mysql
	<sql_settings/>

	sql_query = select id, text, mode from test_table where mode=2
	sql_attr_uint = mode
}


index plain2
{
	source = sql2
	path = <data_path/>/plain2
	docinfo = extern
}
</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,
	mode int
);
</db_create>

<db_insert>
insert into test_table values
( 1, 'first',  1 ),
( 2, 'second',  1 ),
( 3, 'third',  1 ),
( 4, 'fourth', 1 ),
( 5, 'fifth',  1 ),
 
( 10, 'one',    2 ),
( 11, 'two',    2 ),
( 12, 'three',  2 )
</db_insert>

<custom_test><![CDATA[

$results = array();
$ql->Reconnect();

$results[] = 'all index presents';
$results[] = "\n" . $ql->Query ( "SHOW tables" );
$results[] = "\n" . $ql->Query ( "SELECT * FROM plain1, plain2" );

$orig_conf = file('config.conf');

$new_conf = '';
$got_idx2 = false;
foreach ( $orig_conf as $line )
{
	if ( $got_idx2 || strstr ( $line, 'index plain2' ) )
	{
		if ( strstr ( $line, 'index plain2' ) )
			$got_idx2 = true;
		if ( $got_idx2 && strstr ( $line, '}' ) )
			$got_idx2 = false;
		$line = '#' . $line;
	}
	$new_conf .= $line;
}
file_put_contents('config.conf', $new_conf);

RunIndexer ( $errors, '--rotate plain1' ); // just to send SIGHUP to daemon
sleep(2);

$results[] = 'plain2 disabled';
$results[] = "\n" . $ql->Query ( "SHOW tables" );

file_put_contents('config.conf', $orig_conf);
RunIndexer ( $errors, '--rotate plain1' ); // just to send SIGHUP to daemon
sleep(2);

$results[] = 'plain2 re-enabled';
$results[] = "\n" . $ql->Query ( "SHOW tables" );
$results[] = "\n" . $ql->Query ( "SELECT * FROM plain1, plain2" );


]]></custom_test>

</test>