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 (443 lines) | stat: -rw-r--r-- 11,367 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
<?xml version="1.0" encoding="utf-8"?>
<test>

<name>string attribute vs different indexes, attributes UNION</name>
<num_agents>3</num_agents>
<requires><sphinxql_keep_null/></requires>

<config>

indexer
{
	mem_limit		= 16M
}

searchd
{
	<searchd_settings/>
	workers = threads
}

source src_main
{
	type			= mysql
	<sql_settings/>

	sql_query		= SELECT id, body, CONCAT(str1, ' main') AS str1, idd1, 100 as tag FROM test_table
	sql_attr_uint	= idd1
	sql_attr_uint	= tag
	sql_attr_string = str1
}

source src_delta1
{
	type			= mysql
	<sql_settings/>
	
	sql_query		= SELECT id, body, CONCAT(str1, ' delta1') AS str1, idd1, 101 as tag FROM test_table where id>3
	sql_attr_uint	= idd1
	sql_attr_uint	= tag
	sql_attr_string = str1
	sql_query_killlist = SELECT 2
}

source src_delta2
{
	type			= mysql
	<sql_settings/>

	sql_query		= SELECT id, body, 'delta2' as str1, CONCAT(str1, ' delta2') AS str2, idd1, 102 as tag FROM test_table where id>4
	sql_attr_uint	= idd1
	sql_attr_uint	= tag
	sql_attr_string = str1
	sql_attr_string = str2
	sql_query_killlist = SELECT 2
}

<agent0>
index main
{
	source			= src_main
    docinfo			= extern
	path			= <data_path/>/main
}

index delta1
{
	source			= src_delta1
    docinfo			= extern
	path			= <data_path/>/delta1
}

index delta2
{
	source			= src_delta2
    docinfo			= extern
	path			= <data_path/>/delta2
}

index loc_dist1
{
	type = distributed
	local = main
	local = delta1
}

index loc_dist2
{
	type = distributed
	local = main
	local = delta2
}

index dist1
{
	type = distributed
	local = main
	agent = <agent1_address/>:agent1_delta2
}

index dist2
{
	type = distributed
	local = delta2
	agent = <agent2_address/>:agent2_delta1
}

index dist3
{
	type = distributed
	agent = <agent1_address/>:agent1_main
	agent = <agent2_address/>:agent2_delta1
}

source src_bool
{
	type			= mysql
	<sql_settings/>
	sql_query		= SELECT id, body, idd1>2 as attr FROM test_table
	sql_attr_bool	= attr
}
source src_uint
{
	type			= mysql
	<sql_settings/>
	sql_query		= SELECT id, body, idd1*100 as attr FROM test_table
	sql_attr_uint	= attr
}
source src_float
{
	type			= mysql
	<sql_settings/>
	sql_query		= SELECT id, body, idd1/1.73 as attr FROM test_table
	sql_attr_float	= attr
}
source src_bigint
{
	type			= mysql
	<sql_settings/>
	sql_query		= SELECT id, body, idd1*100000000000 as attr FROM test_table
	sql_attr_bigint	= attr
}

index u_bool
{
	source			= src_bool
    docinfo			= extern
	path			= <data_path/>/u_bool
}
index u_uint
{
	source			= src_uint
    docinfo			= extern
	path			= <data_path/>/u_uint
}
index u_float
{
	source			= src_float
    docinfo			= extern
	path			= <data_path/>/u_float
}
index u_bigint
{
	source			= src_bigint
    docinfo			= extern
	path			= <data_path/>/u_bigint
}

index u_dist10
{
	type = distributed
	local = u_bool
	local = u_float
}
index u_dist11
{
	type = distributed
	local = u_float
	local = u_bool
}
index u_dist20
{
	type = distributed
	local = u_bool
	local = u_uint
	local = u_bigint
}
index u_dist21
{
	type = distributed
	local = u_bool
	local = u_bigint
	local = u_uint
}
index u_dist22
{
	type = distributed
	local = u_bigint
	local = u_bool
	local = u_uint
}
index u_dist23
{
	type = distributed
	local = u_bigint
	local = u_uint
	local = u_bool
}

source src_attr1
{
	type			= mysql
	<sql_settings/>
	sql_query		= SELECT id, body, idd1 as attr1, 1 as tag FROM test_table where id in ( 1,2,3 )
	sql_attr_uint	= attr1
	sql_attr_uint = tag
}
source src_attr2
{
	type			= mysql
	<sql_settings/>
	sql_query		= SELECT id, body, idd1 as attr2, 2 as tag FROM test_table where id in ( 4, 5, 6 )
	sql_attr_uint	= attr2
	sql_attr_uint = tag
}
index idx_attr1
{
	source			= src_attr1
    docinfo			= extern
	path			= <data_path/>/idx_attr1
}
index idx_attr2
{
	source			= src_attr2
    docinfo			= extern
	path			= <data_path/>/idx_attr2
}
index u_dist_aa
{
	type = distributed
	local = idx_attr1
	local = idx_attr2
}

source src_mva
{
	type			= mysql
	<sql_settings/>
	sql_query		= SELECT id, body, 2 as tag, '100, 400, 500' as mva  FROM test_table
	sql_attr_uint = tag
	sql_attr_multi = uint mva from field
	sql_field_string = body
}
index idx_mva
{
	source			= src_mva
	docinfo			= extern
	path			= <data_path/>/idx_mva
}

source src_count1
{
	type			= mysql
	<sql_settings/>
	sql_query = SELECT 1, 11 as idd, 'of the box' text UNION SELECT 2, 11 as idd, 'we are the boxes'
	sql_attr_uint	= idd
}

source src_count2
{
	type			= mysql
	<sql_settings/>
	sql_query = SELECT 10, 22 as idd, 'of the fox' text UNION SELECT 11, 22 as idd, 'we are the foxes'
	sql_attr_uint	= idd
}

index count1
{
	source			= src_count1
	docinfo			= extern
	path			= <data_path/>/count1
}

index count2
{
	source			= src_count2
	docinfo			= extern
	path			= <data_path/>/count2
}

index dist_count1
{
	type					= distributed
	local					= count1
	local					= count2
}

index dist_count2
{
	type					= distributed
	local					= count1
	agent					= <my_address/>:count2
}

</agent0>

<agent1>
index agent1_main
{
	source			= src_main
    docinfo			= extern
	path			= <data_path/>/agent1_main
}

index agent1_delta2
{
	source			= src_delta2
    docinfo			= extern
	path			= <data_path/>/agent1_delta2
}
</agent1>

<agent2>
index agent2_delta1
{
	source			= src_delta1
    docinfo			= extern
	path			= <data_path/>/agent2_delta1
}
</agent2>


</config>

<db_create>
CREATE TABLE `test_table`
(
	`id` int(11) NOT NULL default '0',
	`idd1` int(11) NOT NULL default '0',
	`str1` varchar(255) NOT NULL default '',
	`body` varchar(255) NOT NULL default ''
)
</db_create>

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

<db_insert>
INSERT INTO `test_table` VALUES
( 1, 1,		'a aa',		'the dog' ),
( 2, 11,	'c cc',		'the cat' ),
( 3, 11,	'a a',		'the bird' ), 
( 4, 11,	'cc c',		'cat eats bird' ),
( 5, 3, 	'a a',		'dog eats cat' ), 
( 6, 1,		'c cc',		'bird' ), 
( 7, 1,		'a a',		'the cat' ),
( 8, 1,		'a a',		'eats' ),
( 9, 3, 	'c cc',		'the' )
</db_insert>

<sphqueries>
<sphinxql>select * from loc_dist1 order by str1 asc</sphinxql>
<sphinxql>select * from loc_dist1 order by str1 desc</sphinxql>
<sphinxql>select * from loc_dist2 order by str1 asc, idd1 desc</sphinxql>
<sphinxql>select * from loc_dist2 order by str1 desc, idd1 asc</sphinxql>
<sphinxql>select * from loc_dist2 order by str2 asc</sphinxql>
<sphinxql>select * from loc_dist2 order by str2 desc</sphinxql>
<sphinxql>select * from loc_dist2 order by str2 desc, idd1 desc</sphinxql>
<sphinxql>select * from dist1 order by str2 asc, idd1 desc</sphinxql>
<sphinxql>select * from dist1 order by str2 desc, idd1 asc</sphinxql>
<sphinxql>select * from dist2 order by str1 asc</sphinxql>
<sphinxql>select * from dist2 order by str1 desc</sphinxql>
<sphinxql>select * from dist3 order by str1 asc</sphinxql>
<sphinxql>select * from dist3 order by str1 desc, idd1 desc</sphinxql>

<!-- here is going new feature seamless conversion of result set attributes ( bool -> float ) | ( bool -> uint -> bigint ) -->
<sphinxql>select * from u_bool, u_float</sphinxql>
<sphinxql>select * from u_float, u_bool</sphinxql>
<sphinxql>select * from u_bool, u_uint, u_bigint</sphinxql>
<sphinxql>select * from u_uint, u_bool, u_bigint</sphinxql>
<sphinxql>select * from u_uint, u_bigint, u_bool</sphinxql>
<sphinxql>select * from u_bigint, u_uint, u_bool </sphinxql>
<sphinxql>select * from u_dist10</sphinxql>
<sphinxql>select * from u_dist11</sphinxql>
<sphinxql>select * from u_dist20</sphinxql>
<sphinxql>select * from u_dist21</sphinxql>
<sphinxql>select * from u_dist22</sphinxql>
<sphinxql>select * from u_dist23</sphinxql>
<!-- still invalid -->
<sphinxql>select * from u_float, u_uint</sphinxql>
<sphinxql>select * from u_float, u_bigint</sphinxql>
<sphinxql>select * from u_uint, u_float</sphinxql>
<sphinxql>select * from u_bigint, u_float</sphinxql>
<!-- test of exist function -->
<sphinxql>select * from u_dist_aa</sphinxql>
<sphinxql>select *, exist ( ' aTTr2', 11 ) as cnd from u_dist_aa where cnd=11</sphinxql>
<sphinxql>select *, exist ( ' Attr1', 1 ) as cnd from u_dist_aa where cnd=1</sphinxql>
<!-- regression schema attributes with alias -->
<sphinxql>select tag, idd1, idd1 * 2 as rr from dist2</sphinxql>
<sphinxql>select tag, idd1 as r0, r0 * 2 as rr from dist2</sphinxql>
<!-- alias as shema attribute -->
<sphinxql>select tag, idd1 as str1, str1 as str2 from dist2</sphinxql>
<!-- checking attribute aliases -->
<sphinxql>select str1 as str11 from main</sphinxql>

<!-- regression exist -->
<sphinxql>select *, exist ( 'mva', 1000 ) + id as cnd1 from idx_mva where cnd1 &lt; 5</sphinxql>
<sphinxql>select *, exist ( 'body', 1 ) as b from idx_mva</sphinxql>

<!--regression API count(*) vs compat -->
<sphinxql>SELECT *, count(*) as cnt, 1 as gr FROM main GROUP BY gr</sphinxql>

<!-- regression bigint function vs udf return type -->
<sphinxql>select *, bigint(idd1) b, min( bigint(idd1)) c from main</sphinxql>
<sphinxql>select *, bigint(idd1) b, min( bigint(idd1)) c, 1 as gr from main GROUP BY gr</sphinxql>

<!-- empty result set with count(*) -->
<sphinxql>select count(*) from count2 where id in (1,2); show meta</sphinxql>
<sphinxql>select *, count(*) from count2 where id in (1,2); show meta</sphinxql>
<sphinxql>select count(*) from count1, count2 where id in (1,2); show meta</sphinxql>
<sphinxql>select count(*) from count2, count1 where id in (1,2); show meta</sphinxql>
<sphinxql>select *, count(*) from count1, count2 where id in (1,2); show meta</sphinxql>
<sphinxql>select *, count(*) from count2, count1 where id in (1,2); show meta</sphinxql>
<sphinxql>select idd, count(*) from count1, count2 where id in (1,2); show meta</sphinxql>
<sphinxql>select idd, count(*) from count2, count1 where id in (1,2); show meta</sphinxql>
<sphinxql>select *, count(*) from count1, count2 where id in (100); show meta</sphinxql>
<sphinxql>select idd, count(*) from count2, count1 where id in (100); show meta</sphinxql>
<sphinxql>select count(*) from dist_count1 where id in (1,2); show meta</sphinxql>
<sphinxql>select count(*) from dist_count2 where id in (1,2); show meta</sphinxql>
<sphinxql>select *, count(*) from dist_count1 where id in (1,2); show meta</sphinxql>
<sphinxql>select *, count(*) from dist_count2 where id in (1,2); show meta</sphinxql>
<sphinxql>select idd, count(*) from dist_count1 where id in (1,2); show meta</sphinxql>
<sphinxql>select idd, count(*) from dist_count2 where id in (10,11); show meta</sphinxql>
<sphinxql>select *, count(*) from dist_count1 where id in (100); show meta</sphinxql>
<sphinxql>select idd, count(*) from dist_count2 where id in (100); show meta</sphinxql>

<!-- empty result set with constant columns -->
<sphinxql>select *, 123456, 2+2, sin(1.0), sin(idd), idd+1, count(*) from count2</sphinxql>
<sphinxql>select *, 123456, 2+2, sin(1.0), sin(idd), idd+1, count(*) from count2 where id in (1,2)</sphinxql>
</sphqueries>

<queries>
<query select="*, count(*) as cnt, 1 as gr " groupfunc="attr" groupattr="gr" index="main"/>
</queries>
</test>