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 (390 lines) | stat: -rw-r--r-- 14,173 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
<?xml version="1.0" encoding="utf-8"?>
<test>
<name>select expressions, functions, operators</name> <!-- all the misc tests -->

<config>
indexer
{
	mem_limit = 16M
}

searchd
{
	<searchd_settings/>
	workers = threads
	thread_stack = 256K
}

source test
{
	type = mysql
	<sql_settings/>
	sql_query = SELECT *, '1,2,3,4,5,6.0' AS poly2d_attr FROM test_table
	sql_attr_uint = aa
	sql_attr_multi = uint mm from field
	sql_attr_string = kk
	sql_attr_float = f1
	sql_attr_float = f2
	sql_attr_string = poly2d_attr
}

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

source cmp
{
	type = mysql
	<sql_settings/>
	sql_query = SELECT * FROM cmp_table
	sql_attr_multi = uint mva32 from field
	sql_attr_multi = bigint mva64 from field
	sql_attr_float = f1
	sql_attr_uint = gid
}
index cmp
{
	source	= cmp
	path	= <data_path/>/cmp
}

source cmp2
{
	type = mysql
	<sql_settings/>
	sql_query = SELECT * FROM cmp_table
	sql_attr_uint = f1
	sql_attr_uint = gid
}
index cmp2
{
	source	= cmp2
	path	= <data_path/>/cmp2
}

source strings
{
	type = mysql
	<sql_settings/>
	sql_query = SELECT *, 'dummy' FROM string_table
	sql_attr_string = string_value
}

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

index dist
{
	type = distributed
	agent = <my_address/>:test
	agent_connect_timeout	= 1000
	agent_query_timeout		= 3000	
}

index strings_dist
{
	type = distributed
	agent = <my_address/>:strings
}

source test1
{
	type = mysql
	<sql_settings/>
	sql_query = SELECT id, 11 as idd, string_value FROM string_table1
	sql_attr_uint = idd
	sql_field_string = string_value
}

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

index test1_loc
{
	type = distributed
	local = test1
}

index test1_dist
{
	type = distributed
	agent = <my_address/>:test1
}

</config>

<db_create>
CREATE TABLE test_table
(
	id INT NOT NULL,
	aa INT NOT NULL,
	title VARCHAR(255) NOT NULL,
	mm VARCHAR(255) NOT NULL,
	kk VARCHAR(255) NOT NULL,
	f1 FLOAT NOT NULL,
	f2 FLOAT NOT NULL
);
</db_create>

<db_create>
CREATE TABLE cmp_table
(
	id INT NOT NULL,
	title VARCHAR(255) NOT NULL,
	mva32 VARCHAR(255) NOT NULL,
	mva64 VARCHAR(255) NOT NULL,
	f1 FLOAT NOT NULL,
	gid INT NOT NULL
);
</db_create>

<db_create>
CREATE TABLE string_table
(
	id INT NOT NULL,
	string_value VARCHAR(255) NOT NULL
);
</db_create>

<db_create>
CREATE TABLE string_table1
(
	id INT NOT NULL,
	string_value VARCHAR(255) NOT NULL
);
</db_create>

<db_drop>DROP TABLE IF EXISTS test_table;</db_drop>
<db_drop>DROP TABLE IF EXISTS cmp_table;</db_drop>
<db_drop>DROP TABLE IF EXISTS string_table;</db_drop>
<db_drop>DROP TABLE IF EXISTS string_table1;</db_drop>


<db_insert>
INSERT INTO test_table ( id, aa, title, mm, kk, f1, f2 ) VALUES
( 1, 2, 'dummy', '', 'one', 0, 0 ),
( 10, 3, 'ohai', '7 40', 'ten', 0, 0 ),
( 11, 4, 'ohai2', '', 'eleventy', 0.123123, 0.456789 )
</db_insert>

<db_insert>
INSERT INTO cmp_table VALUES
( 1, 'dummy', '101, 107, 102', '-100, -50, 20, 70', 1.2, 10 ),
( 2, 'dummy', '201, 220, 210', '-200, -350 ', 21.2, 20 ),
( 3, 'dummy', '310, 330, 301', '-300, -350, 320', 31.3, 33 ),
( 4, 'dummy', '900, 400, 601', '1000, 500, 401', 101.2, 110 )
</db_insert>

<db_insert>
INSERT INTO string_table VALUES
(1, 'asdf'),
(2, 'ASDF'),
(3, 'qwer'),
(4, '')
</db_insert>

<db_insert>
INSERT INTO string_table1 VALUES
(1, 'as\'df'),
(2, 'ASDF'),
(3, 'as df'),
(4, '')
</db_insert>

<query_attributes>
	<attr>aa</attr>
	<attr>sel</attr>
</query_attributes>

<queries>
	<query select="aa div 2 as sel, *" index="test"/>
	<query select="aa / 2 as sel, *" index="test"/>
	<query select="aa mod 2 as sel, *" index="test"/>
	<query select="aa % 2 as sel, *" index="test"/>
</queries>
	

<sphqueries>

<!-- test boolean operator precedence -->
<sphinxql>SELECT 0 AND 0 OR 1 AS a, 0 AND 1 OR 1 AS b, 1 OR 0 AND 0 AS c, 1 OR 1 AND 0 AS d FROM test WHERE id=1</sphinxql>

<!-- test common ariphmetic -->
<sphinxql>SELECT id, aa div 2 as sel from test</sphinxql>
<sphinxql>SELECT id, aa / 2 as sel from test</sphinxql>
<sphinxql>SELECT id, aa mod 2 as sel from test</sphinxql>
<sphinxql>SELECT id, aa % 2 as sel from test</sphinxql>

<!-- test argument type check -->
<sphinxql>SELECT id, CRC32('test') FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT id, ABS(CRC32('test')) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT id, IF(IN(mm,7),111,222) FROM test</sphinxql>
<sphinxql>SELECT IN(aa-(aa-15), 15) FROM test WHERE id=10</sphinxql>

<!-- various function and operators for test coverage -->
<sphinxql>SELECT SINT(1-2) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT FIBONACCI(5) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT INTERVAL(1, -1,3,5.0) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT INTERVAL(id, id-1, id+2) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT BITDOT(5, 11,33,55) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT GEODIST(0,0,1,1) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT CONTAINS(POLY2D(1,2,3,4,5,6.0),2,3), CONTAINS(POLY2D(1.0,1+1,aa,4,5,6),22,3) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT CONTAINS(GEOPOLY2D(55.7522222, 37.6155556, 40.7141667, -74.0063889, 37.9833333, 23.7333333), 51.5, -0.116667) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT CONTAINS(GEOPOLY2D(55.7522222, 37.6155556, 40.7141667, -74.0063889, 37.9833333, 23.7333333), 43.25, -2.9666667) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT CRC32(TO_STRING(123 + 877)) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT ABS(-1), ABS(-1.1), CEIL(1.3), FLOOR(1.3), COS(3.14/2), LN(2.7), LOG10(100), EXP(1) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT SINT(aa), NOT SINT(aa), CRC32(kk) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT IN(id, 10.1) FROM test WHERE id=10;</sphinxql>

<sphinxql>SELECT (1=1 AND 1=0), (1=1 AND 1=1), (1=0 AND 1=0), (1=0 AND 1=1) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT (1=1 OR 1=0), (1=1 OR 1=1), (1=0 OR 1=0), (1=0 OR 1=1) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT NOT 1=1, NOT 1=0 FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT 1&lt;=1, 1&lt;=2, 1&lt;&gt;1, 1&lt;&gt;0 FROM test WHERE id=10</sphinxql>

<sphinxql>SELECT 3/2, id*2-2.1, 1.0-(1.0+id), 2*(3*id), 2.0/(3.0*id), 3 div 2, 3.1 div 2.2 FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT (1-id)+id, (1.0/id)*id, id/2.5 FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT 1&amp;3, 1&amp;2, 1|3, 1|2, 13%10, 3%10 FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+11 FROM test WHERE id=10</sphinxql>

<sphinxql>SET GLOBAL @happyvar = (432)</sphinxql>
<sphinxql>SELECT IN(mm, @happyvar) FROM test WHERE id=10</sphinxql>

<sphinxql>SELECT FLOOR(f1*1000)*100000 + FLOOR(f2*1000) FROM test WHERE id=11</sphinxql>
<sphinxql>SELECT FLOOR(f1*1000)*10000000 + FLOOR(f2*1000) FROM test WHERE id=11</sphinxql>

<!-- added <,> comparsion to float and int to float conversion at filter -->
<sphinxql>SELECT id FROM cmp, cmp2 WHERE f1>22</sphinxql>
<sphinxql>SELECT id FROM cmp, cmp2 WHERE f1 between 21 and 32</sphinxql>
<sphinxql>SELECT id FROM cmp WHERE f1&lt;31.3</sphinxql>
<sphinxql>SELECT id FROM cmp WHERE f1&gt;=31.3</sphinxql>
<sphinxql>SELECT id, mva32 FROM cmp WHERE mva32&lt;=310</sphinxql>
<sphinxql>SELECT id, mva32 FROM cmp WHERE mva32&gt;220</sphinxql>
<sphinxql>SELECT id, mva32 FROM cmp WHERE mva32&lt;301</sphinxql>
<sphinxql>SELECT id, mva32 FROM cmp WHERE mva32&gt;=330</sphinxql>
<sphinxql>SELECT id, mva64 FROM cmp WHERE mva64&lt;=-350</sphinxql>
<sphinxql>SELECT id, mva64 FROM cmp WHERE mva64&gt;-200</sphinxql>
<sphinxql>SELECT id, mva64 FROM cmp WHERE mva64 between -100 and 400</sphinxql>
<sphinxql>SELECT id, mva32 FROM cmp WHERE mva32 between 105 and 205</sphinxql>

<!-- lets check that WEIGHT() works in expressions -->
<sphinxql>SELECT id, WEIGHT()*10 FROM test WHERE MATCH('ohai')</sphinxql>

<!-- check strings vs unescaping -->
<sphinxql>SELECT crc32('one two'), crc32('one\ttwo'), crc32('one\ntwo') FROM test WHERE id=1</sphinxql>

<!-- check misc crazy stuff -->
<sphinxql>SELECT @@session.auto_increment_increment</sphinxql>
<sphinxql>SHOW COLLATION</sphinxql>
<sphinxql>SHOW CHARACTER SET</sphinxql>

<!-- added check of different functions against MVA attributes -->
<sphinxql>SELECT id, IN(mva32,220,230) from cmp WHERE id=2</sphinxql>
<!--fixme! The query below must be processed without errors -->
<sphinxql>SELECT id, IN(mva64,-350,230) from cmp WHERE id=2</sphinxql>
<sphinxql>SELECT id, IN(mva64,320) from cmp WHERE id=3</sphinxql>
<sphinxql>SELECT id, to_string(mva32) from cmp WHERE id=3</sphinxql>
<sphinxql>SELECT id, to_string(mva64) from cmp WHERE id=3</sphinxql>
<sphinxql>SELECT id, length(mva32) from cmp WHERE id=3</sphinxql>
<sphinxql>SELECT id, length(mva64) from cmp WHERE id=3</sphinxql>
<sphinxql>SELECT id, least(mva64) from cmp WHERE id=3</sphinxql>
<sphinxql>SELECT id, greatest(mva32) from cmp WHERE id=3</sphinxql>
<sphinxql>SELECT id, greatest(mva64) from cmp WHERE id=3</sphinxql>

<sphinxql>SELECT id, min(mva32) from cmp WHERE id=3</sphinxql>
<sphinxql>SELECT id, max(mva32) from cmp WHERE id=3</sphinxql>

<sphinxql>SELECT id, min(mva64) from cmp WHERE id=3</sphinxql>
<sphinxql>SELECT id, max(mva64) from cmp WHERE id=3</sphinxql>


<sphinxql>SELECT id, log10(mva32) from cmp WHERE id=3</sphinxql>
<sphinxql>SELECT id, log10(mva64) from cmp WHERE id=3</sphinxql>

<!-- .NET connector uses "select timediff(curtime(),utc_time());" -->
<sphinxql>SELECT bigint(timediff(curtime(),utc_time())) % 15</sphinxql>

<!-- MySQL Workbench 6.0 and above -->
<sphinxql>SHOW SESSION VARIABLES LIKE 'lower_case_table_names'</sphinxql>
<sphinxql>SELECT current_user()</sphinxql>
<sphinxql>SELECT connection_id()</sphinxql>
<sphinxql>SET CHARACTER SET utf8</sphinxql>
<sphinxql>SET SQL_SAFE_UPDATES=1</sphinxql>
<sphinxql>SHOW SESSION VARIABLES LIKE 'sql_mode'</sphinxql>
<sphinxql>SHOW DATABASES</sphinxql>

<sphinxql>SELECT CONTAINS(POLY2D(poly2d_attr),2,3) FROM test LIMIT 1</sphinxql>

<sphinxql>SELECT 0 zero, 1/0, 1/zero FROM cmp LIMIT 1</sphinxql>
<sphinxql>SELECT 0 zero, SINT(-1) negative, ln(0), ln(zero), ln(-1), ln(negative) FROM cmp LIMIT 1</sphinxql>
<sphinxql>SELECT 0 zero, SINT(-1) negative, log2(0), log2(zero), log2(-1), log2(negative) FROM cmp LIMIT 1</sphinxql>
<sphinxql>SELECT 0 zero, SINT(-1) negative, log10(0), log10(zero), log10(-1), ln(negative) FROM cmp LIMIT 1</sphinxql>
<sphinxql>SELECT 0 zero, SINT(-1) negative, sqrt(0), sqrt(zero), sqrt(-1), sqrt(negative) FROM cmp LIMIT 1</sphinxql>

<!-- IN() function for string attributes -->
<sphinxql>SELECT IN(kk,'one','ten','eleventy') FROM test</sphinxql>
<sphinxql>SELECT IN(kk,'is','not','there') FROM test</sphinxql>

<!-- ATAN2() function -->
<sphinxql>SELECT ATAN2(0,1) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT ATAN2(1,0) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT ATAN2(0.75,0.25) FROM test WHERE id=10</sphinxql>
<sphinxql>SELECT ATAN2(0.25,0.75) FROM test WHERE id=10</sphinxql>

<sphinxql>SELECT GEODIST(0,0,1,1,{in=radians,out=kilometers}) FROM test WHERE id=10</sphinxql>

<!-- .NET connector 6.9.6 uses select timediff(now(), utc_timestamp()) -->
<sphinxql>SELECT bigint(timediff(now(),utc_timestamp())) % 15</sphinxql>

<!-- filter by empty string -->
<sphinxql>select * from strings where string_value!=''</sphinxql>
<sphinxql>select * from strings where string_value=''</sphinxql>

<!-- collation support in expressions -->
<sphinxql>select id, string_value, in(string_value,'asdf','qwer') as in_string, string_value='asdf' AS is_string from strings</sphinxql>
<sphinxql>select id, string_value from strings where string_value='asdf'</sphinxql>
<sphinxql>select id, string_value, (string_value='asdf' or string_value='ASDF') as in_string from strings</sphinxql>
<sphinxql>select id, string_value, (string_value='asdf' or string_value='qwer') as in_string from strings</sphinxql>

<!-- IN() filter for multiple strings, including empty ones, also test string pointers -->
<sphinxql>select id, string_value from strings where string_value in ('asdf','qwer','')</sphinxql>
<sphinxql>select id, string_value from strings where string_value in ('asdf','qwer')</sphinxql>
<sphinxql>select id, string_value from strings where string_value not in ('')</sphinxql>
<sphinxql>select id, to_string(id) as p from strings where p in('1','3')</sphinxql>
<sphinxql>select id, string_value from strings_dist where string_value in ('asdf','qwer')</sphinxql>
<sphinxql>select id, string_value from strings_dist where string_value not in ('')</sphinxql>

<!-- CRC32 as BIGINT -->
<sphinxql>select CRC32('4759') AS test_crc FROM strings LIMIT 1</sphinxql>
<sphinxql>select BIGINT(CRC32('4759')) AS test_crc FROM strings LIMIT 1</sphinxql>
<sphinxql>select CRC32('4759') AS test_crc, CRC32('4759')=2182940993 AS is_crc FROM strings LIMIT 1</sphinxql>

<!-- GEOPOLY -->
<sphinxql>SELECT CONTAINS(GEOPOLY2D(44.0,-88.0, 44.3,-88.6, 44.6,-88.0), 44.3, -88.5 ) from strings limit 1</sphinxql>
<sphinxql>SELECT CONTAINS(GEOPOLY2D(44.0,-88.0, 44.3,-88.6, 44.6,-88.0), 44.6, -88.5 ) from strings limit 1</sphinxql>
<sphinxql>SELECT CONTAINS(GEOPOLY2D(44.0,-88.0, 44.0, -88.0, 44.3,-88.6, 44.6,-88.0), 44.3, -88.5 ) from strings limit 1</sphinxql>
<sphinxql>SELECT CONTAINS(GEOPOLY2D(44.0,-88.0, 44.0, -88.0, 44.3,-88.6, 44.6,-88.0), 44.6, -88.5 ) from strings limit 1</sphinxql>

<!-- regression hash as geodist argument -->
<sphinxql>select GEODIST(0,0,1,1, {in=radians, out=m} ) FROM dist</sphinxql>
<sphinxql>select GEODIST(0,0,1,1, {out=m, in=radians} ) FROM dist</sphinxql>
<sphinxql>select GEODIST(0,0,1,1, {out=m} ) FROM dist</sphinxql>
<sphinxql>select GEODIST(0,0,1,1, {in=radians} ) FROM dist</sphinxql>

<!-- JDBC, MySQL Connector/J 5.1.36+ multiple sysvars select -->
<sphinxql>select @@session.auto_increment_increment AS v1, @@character_set_client as v2</sphinxql>

<!-- regression escaped quote cut at distributed index -->
<sphinxql>SELECT id, IN(string_value,'as\'df') FROM test1_loc order by id asc</sphinxql>
<sphinxql>SELECT id, IN(string_value,'as\'df') FROM test1_dist order by id asc</sphinxql>

</sphqueries>

</test>