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
|
<?xml version="1.0" encoding="utf-8"?>
<test>
<name>n best group by</name>
<config>
indexer
{
mem_limit = 28M
}
searchd
{
<searchd_settings/>
workers = threads
}
source src_full
{
type = mysql
<sql_settings/>
sql_query = SELECT id, tag, gr, text FROM test_table WHERE id>=$start AND id<=$end
sql_query_range = select 1, 20
sql_query_pre = SET NAMES UTF8
sql_attr_uint = tag
sql_attr_uint = gr
}
source src_half1 : src_full
{
sql_query_range = select 1, 10
}
source src_half2 : src_full
{
sql_query_range = select 11, 20
}
index rt_full
{
type = rt
path = <data_path/>/rt_full
rt_field = text
rt_attr_uint = tag
rt_attr_uint = gr
}
index idx_full
{
source = src_full
path = <data_path/>/idx_full
docinfo = extern
}
index idx_half1 : idx_full
{
source = src_half1
path = <data_path/>/idx_half1
}
index idx_half2 : idx_full
{
source = src_half2
path = <data_path/>/idx_half2
}
index idx_ag1 : idx_half1
{
path = <data_path/>/idx_ag1
}
index idx_ag2 : idx_half2
{
path = <data_path/>/idx_ag2
}
index idx_local
{
type = distributed
local = idx_half1
local = idx_half2
}
index idx_combined
{
type = distributed
local = idx_half1
agent = <my_address/>:idx_ag2
agent_connect_timeout = 1000
agent_query_timeout = 3000
}
index idx_remote
{
type = distributed
agent = <my_address/>:idx_ag1
agent = <my_address/>:idx_ag2
agent_connect_timeout = 1000
agent_query_timeout = 3000
}
</config>
<!-- name made especially non-regular to avoid syntax messing with usual indexes -->
<metaindex name='META:multi'>
<index>rt_full</index>
<index>idx_full</index>
<index>idx_local</index>
<index>idx_combined</index>
<index>idx_remote</index>
</metaindex>
<sphqueries>
<!-- First, just show all the indexes -->
<sphinxql>
INSERT INTO `rt_full`(id,gr,tag,text) VALUES
( 1, 102, 9, 'test'), ( 2, 102, 18, 'test'), ( 3, 103, 7, 'test'), ( 4, 103, 16, 'test'), ( 5, 104, 5, 'test'),
( 6, 104, 14, 'test'), ( 7, 105, 3, 'test'), ( 8, 105, 12, 'test'), ( 9, 105, 1, 'test'), ( 10, 105, 10, 'test'),
( 11, 102, 29, 'test'), ( 12, 102, 8, 'test'), ( 13, 103, 27, 'test'), ( 14, 103, 6, 'test'), ( 15, 104, 25, 'test'),
( 16, 104, 4, 'test'), ( 17, 105, 23, 'test'), ( 18, 105, 2, 'test'), ( 19, 105, 21, 'test'), ( 20, 105, 0, 'test')
</sphinxql>
<sphinxql>select * from META:multi</sphinxql>
<!-- Check the aggretage on different kind of dist indexes -->
<sphinxql>select id, gr, <variants v1='sum(tag)' v2='avg(tag)' v3='min(tag)' v4='max(tag)'/> as t from META:multi where match ('test') group<variants v1='' v2='2' v3='4' v4='8'/> by gr<variants v1='' v2='within group order by tag asc' v3='within group order by tag desc' /></sphinxql>
</sphqueries>
<db_create>
CREATE TABLE `test_table` (
`id` int(11),
`gr` int(11),
`tag` int(11),
`text` varchar(255) NOT NULL
)
</db_create>
<db_drop>
DROP TABLE IF EXISTS `test_table`
</db_drop>
<db_insert>SET NAMES utf8</db_insert>
<db_insert>
INSERT INTO `test_table` VALUES
( 1, 102, 9, 'test'), ( 2, 102, 18, 'test'), ( 3, 103, 7, 'test'), ( 4, 103, 16, 'test'), ( 5, 104, 5, 'test'),
( 6, 104, 14, 'test'), ( 7, 105, 3, 'test'), ( 8, 105, 12, 'test'), ( 9, 105, 1, 'test'), ( 10, 105, 10, 'test'),
( 11, 102, 29, 'test'), ( 12, 102, 8, 'test'), ( 13, 103, 27, 'test'), ( 14, 103, 6, 'test'), ( 15, 104, 25, 'test'),
( 16, 104, 4, 'test'), ( 17, 105, 23, 'test'), ( 18, 105, 2, 'test'), ( 19, 105, 21, 'test'), ( 20, 105, 0, 'test')
</db_insert>
</test>
|