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 (109 lines) | stat: -rw-r--r-- 4,124 bytes parent folder | download | duplicates (4)
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
<?xml version="1.0" encoding="utf-8"?>
<test>

<name>string vs within group order</name>

<config>
indexer
{
	mem_limit		= 16M
}

searchd
{
	<searchd_settings/>
	workers = threads
}

source src
{
	type			= mysql
	<sql_settings/>

	sql_query		= SELECT id, idd1, str1, body FROM test_table
	sql_attr_uint	= idd1
	sql_attr_string	= str1
}

index plain
{
	source			= src
    docinfo			= extern
	path			= <data_path/>/plain
}

index rt
{
	dict = keywords
	type	= rt
	rt_attr_uint	= idd1
	rt_attr_string	= str1
	rt_field	= body
	docinfo	= extern
	path			= <data_path/>/rt
}
</config>

<db_create>
CREATE TABLE `test_table`
(
	`id` int(11) NOT NULL default '0',
	`idd1` int(11) NOT NULL default '0',
	`str1` varchar(1024) NOT NULL default '',
	`body` varchar(1024) 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>

<queries>
<query mode="extended2" index="plain" groupattr="idd1" groupfunc="attr" groupsort="idd1 asc" sortmode="extended" sortby="str1 asc"></query>
<query mode="extended2" index="plain" groupattr="idd1" groupfunc="attr" groupsort="idd1 asc" sortmode="extended" sortby="str1 desc"></query>
<query mode="extended2" index="plain" groupattr="idd1" groupfunc="attr" groupsort="idd1 asc" sortmode="extended" sortby="str1 asc">the | dog | cat</query>
<query mode="extended2" index="plain" groupattr="idd1" groupfunc="attr" groupsort="idd1 asc" sortmode="extended" sortby="str1 desc">the | eats | bird</query>
</queries>

<sphqueries>
<sphinxql>select * from plain group by idd1 within group order by str1 asc</sphinxql>
<sphinxql>select * from plain group by idd1 within group order by str1 desc</sphinxql>
<sphinxql>select * from plain where match('the | dog | cat') group by idd1 within group order by str1 asc</sphinxql>
<sphinxql>select * from plain where match('the | eats | bird') group by idd1 within group order by str1 desc</sphinxql>
<sphinxql>select *, group_concat(id) from plain where match('the | eats | bird') group by idd1 within group order by str1 asc</sphinxql>
<sphinxql>select * from ( select *, sum(id) as s1, sum(idd1) as s2, group_concat(id) from plain where match('the | eats | bird') group by idd1 within group order by str1 asc ) order by s1 asc</sphinxql>
<sphinxql>select * from ( select *, sum(id) as s1, sum(idd1) as s2, s1+s2 as s3, group_concat(id) from plain where match('the | eats | bird') group by idd1 within group order by str1 asc ) order by s1 desc</sphinxql>
<sphinxql>select * from ( select *, sum(id) as s1, sum(idd1) as s2, s1+s2 as s3, group_concat(id) from plain where match('the | eats | bird') group by idd1 within group order by str1 asc ) order by s2 desc</sphinxql>
<sphinxql>select * from ( select *, sum(id) as s1, sum(idd1) as s2, s1+s2 as s3, group_concat(id) from plain where match('the | eats | bird') group by idd1 within group order by str1 asc ) order by s3 desc</sphinxql>

<!-- regression aggregate dependend attributes at RT index -->
<sphinxql>
INSERT INTO rt (id, idd1, str1, body) 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' )
</sphinxql>
<sphinxql>select *, sum(id) as s1, sum(idd1) as s2, s1+s2 as s3, group_concat(id) from plain where match('the | eats | bird') group by idd1 within group order by str1 asc</sphinxql>
<sphinxql>select *, sum(id) as s1, sum(idd1) as s2, s1+s2 as s3, group_concat(id) from rt    where match('the | eats | bird') group by idd1 within group order by str1 asc</sphinxql>
</sphqueries>

</test>