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
|
<?xml version="1.0" encoding="utf-8"?>
<test>
<name>sorting vs string</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
{
type = rt
docinfo = extern
path = <data_path/>/rt
rt_attr_uint = IDD1
rt_attr_uint = iDD2
rt_attr_string = Str1
rt_attr_string = Str2
rt_field = body
rt_mem_limit = 128K
}
index rt1
{
type = rt
docinfo = extern
path = <data_path/>/rt1
rt_attr_uint = IDD1
rt_attr_string = str1
rt_field = body
rt_mem_limit = 128K
}
index dist
{
type = distributed
local = plain
local = rt
}
</config>
<db_create>
CREATE TABLE `test_table`
(
`id` int(11) NOT NULL default '0',
`idd1` int(11) NOT NULL default '0',
`idd2` int(11) NOT NULL default '0',
`str1` varchar(1024) NOT NULL default '',
`str2` 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, 9, 'aaa', 'h', 'the dog' ),
( 2, 11, 8, 'c cc', 'c', 'the cat' ),
( 3, 13, 7, 'a a', 'cc', 'the bird' ),
( 4, 11, 6, 'cc', 'cc', 'cat eats bird' ),
( 5, 3, 5, 'cc', 'c', 'dog eats cat' ),
( 6, 11, 4, 'ddd', 'hh', 'bird' ),
( 7, 5, 4, 'a', 'cc', 'the' ),
( 8, 6, 4, '', 'cc', 'the' ),
( 9, 7, 4, 'a', '', 'the' )
</db_insert>
<sphqueries>
<sphinxql>insert into rt (id, Idd1, idd2, str1, str2, body) values ( 10, 5, 4, '', 'cc', 'the' )</sphinxql>
<sphinxql>insert into rt (id, idd1, IDD2, str1, str2, body) values ( 11, 5, 4, 'a', '', 'the' )</sphinxql>
<sphinxql>insert into rt (id, idd1, idd2, Str1, str2, body) values ( 12, 6, 4, 'a', 'cc', 'the' )</sphinxql>
<sphinxql>insert into rt (id, idd1, idd2, str1, STR2, body) values ( 13, 4, 4, 'ddd', 'hh', 'bird' )</sphinxql>
<sphinxql>insert into rt (id, idd1, idd2, str1, str2, Body) values ( 14, 3, 5, 'cc', 'c', 'dog eats cat' )</sphinxql>
<sphinxql>insert into rt (id, idd1, idd2, str1, str2, BODY) values ( 15, 2, 6, 'cc', 'cc', 'cat eats bird' )</sphinxql>
<sphinxql>insert into rt (id, idd1, idd2, str1, sTr2, body) values ( 16, 1, 7, 'a a', 'cc', 'the bird' )</sphinxql>
<sphinxql>insert into rt (id, idd1, idd2, stR1, str2, body) values ( 17, 1, 8, 'c cc', 'c', 'the cat' )</sphinxql>
<sphinxql>insert into rt (id, idd1, iDD2, str1, str2, body) values ( 18, 11, 9, 'aaa', 'h', 'the dog' )</sphinxql>
<sphinxql>select * from plain order by Str1 desc</sphinxql>
<sphinxql>select * from rt order by sTR1 desc</sphinxql>
<sphinxql>select * from rt order by STR2 asc, Str1 desc</sphinxql>
<sphinxql>select * from dist order by Str1 desc</sphinxql>
<sphinxql>select * from dist order by Str1 desc, IDD1 asc</sphinxql>
<sphinxql>select * from dist where match ('the') order by Str1 desc</sphinxql>
<sphinxql>select * from dist where match ('the') order by Str1 desc, iDD1 asc</sphinxql>
<sphinxql>select * from dist where match ('cat | eats') order by Str1 asc</sphinxql>
<sphinxql>select * from dist where match ('cat | eats') order by Str1 asc, sTr2 desc</sphinxql>
<sphinxql>select * from dist where match ('cat | eats') order by Str1 asc, Idd1 asc</sphinxql>
<!-- regression missed string pool in grouper on match -->
<sphinxql>select * from dist where match ('cat | eats') group by str1 within group order by id desc</sphinxql>
<sphinxql>select * from dist group by str2 within group order by id desc</sphinxql>
<!-- regression sorter gives first matches instead bests -->
<sphinxql>select id, str1 from rt group by idd1 order by id asc limit 0,2 option max_matches=2</sphinxql>
<sphinxql>select id, str1 from rt group by idd1 order by id asc limit 2,2 option max_matches=4</sphinxql>
<!-- added sorting by STRING_PTR -->
<sphinxql>select id, idd1, to_string(idd1) as c from plain order by idd1 asc, id desc</sphinxql>
<sphinxql>select id, idd1, to_string(idd1) as c from plain order by c desc, id desc</sphinxql>
<sphinxql>select id, idd1, to_string(idd1) as c from plain where match ( 'the' ) order by c desc, id desc</sphinxql>
<sphinxql>select id, idd2, idd2+4 as i, to_string(i) as c from rt order by i asc, id desc</sphinxql>
<sphinxql>select id, idd2, idd2+4 as i, to_string(i) as c from rt order by c desc, id desc</sphinxql>
<sphinxql>select id, idd2, to_string(idd1) as c from rt where match ( 'the' ) order by c desc, id asc</sphinxql>
<!-- regression double free of pool storage on query of multi index -->
<sphinxql>insert into rt1 (id, idd1, str1, Body) values ( 14, 3, '', 'dog eats bone' )</sphinxql>
<sphinxql>insert into rt1 (id, idd1, str1, Body) values ( 15, 3, '', 'cat ear' )</sphinxql>
<sphinxql>select id, str1 from plain,rt1 where match ('^cat$') order by id asc</sphinxql>
<sphinxql>select id, str1 from plain,rt1 where match ('cat') order by id asc</sphinxql>
</sphqueries>
<queries>
<!-- regression crash on sort by string attr -->
<query mode="extended2" index="plain" sortmode="attr_desc" sortby="str1"></query>
<query select="to_string(idd1) i1, idd1" index="plain" sortmode="attr_desc" sortby="str1"></query>
</queries>
</test>
|