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
|
<?xml version="1.0" encoding="utf-8"?>
<test>
<name>ranged-query vs joined field and mva attribute</name>
<requires>
<non-rt/>
<variant_match />
</requires>
<config>
indexer
{
mem_limit = 16M
}
searchd
{
<searchd_settings/>
}
source test
{
type = mysql
<sql_settings/>
sql_range_step = 2
sql_query = SELECT id, gid, title FROM test
sql_joined_field = text from ranged-query; select id, text from test where id between $start and $end; select 1, 5
sql_attr_uint = gid
<Dynamic>
<Variant>sql_attr_multi = uint mva from ranged-query; select id, mva from mva where id between $start and $end; select 2, 5</Variant>
<Variant>sql_attr_multi = bigint mva from ranged-query; select id, mva from mva where id between $start and $end; select 2, 5</Variant>
</Dynamic>
}
index test
{
source = test
path = <data_path/>/test
dict = keywords
min_prefix_len = 1
}
</config>
<db_create>
create table test
(
id int not null,
gid int not null,
title varchar(255) not null,
text varchar(255) not null
);
</db_create>
<db_create>
create table mva
(
id int not null,
mva int not null
);
</db_create>
<db_drop>drop table if exists test;</db_drop>
<db_drop>drop table if exists mva;</db_drop>
<db_insert>insert into test values ( 1, 101, 'not found', 'notice found' );</db_insert>
<db_insert>insert into test values ( 2, 102, 'not anyone', 'notice goods' );</db_insert>
<db_insert>insert into test values ( 3, 103, 'not grant', 'notice goods' );</db_insert>
<db_insert>insert into test values ( 4, 104, 'not grant', 'everyone' );</db_insert>
<db_insert>insert into test values ( 5, 105, 'not anyone', 'grant' );</db_insert>
<db_insert>insert into test values ( 6, 106, 'not fun', 'natural' );</db_insert>
<db_insert>insert into mva values (1, 1001), (1, 2001);</db_insert>
<db_insert>insert into mva values (2, 1002), (2, 2002);</db_insert>
<db_insert>insert into mva values (3, 1003), (3, 2003);</db_insert>
<db_insert>insert into mva values (4, 1004), (4, 2004);</db_insert>
<db_insert>insert into mva values (5, 1005), (5, 2005);</db_insert>
<db_insert>insert into mva values (6, 1006), (6, 2006);</db_insert>
<sphqueries>
<sphinxql>select * from test</sphinxql>
<sphinxql>select * from test where mva >= 2004 and mva < 2007</sphinxql>
<sphinxql>select * from test where match ('goo*')</sphinxql>
<sphinxql>select * from test where match ('g*')</sphinxql>
<sphinxql>select * from test where match ('g* !(@title g*)')</sphinxql>
<sphinxql>select * from test where match ('everyone')</sphinxql>
<sphinxql>select * from test where match ('anyone | everyone')</sphinxql>
<sphinxql>select * from test where match ('@text g*')</sphinxql>
<sphinxql>select * from test where match ('natural')</sphinxql>
<sphinxql>select * from test where mva=1001</sphinxql>
<sphinxql>select * from test where match ('@text')</sphinxql>
<sphinxql>select * from test where match ('@text ')</sphinxql>
<sphinxql>select * from test where match ('@text {')</sphinxql>
<sphinxql>select * from test where match ('everyone @text {')</sphinxql>
</sphqueries>
</test>
|