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
|
<?xml version="1.0" encoding="utf-8"?>
<test>
<name>index weights + sort by expression test (fullscan too)</name>
<config>
indexer
{
mem_limit = 32M
}
searchd
{
<searchd_settings/>
workers = threads
}
source test1
{
type = mysql
<sql_settings/>
sql_query = select * from test_table where id%2=0
sql_attr_uint = attr
}
index test1
{
source = test1
path = <data_path/>/test1
}
source test2
{
type = mysql
<sql_settings/>
sql_query = select * from test_table where id%2=1
}
index test2
{
source = test2
path = <data_path/>/test2
}
index test3
{
type = rt
path = <data_path/>/test3
rt_field = title
rt_attr_uint = dummy
}
index test4
{
type = rt
path = <data_path/>/test4
rt_field = title
rt_attr_uint = dummy
}
source test_rs
{
type = mysql
<sql_settings/>
sql_query = select * from test_table
sql_attr_uint = attr
}
index test_rs
{
source = test_rs
path = <data_path/>/test_rs
docinfo = extern
}
</config>
<db_create>
create table test_table
(
id int not null,
title varchar(255) not null,
attr int not null
);
</db_create>
<db_drop>drop table if exists test_table;</db_drop>
<db_insert>insert into test_table values ( 1, 'asdf asdf asdf', 11 );</db_insert>
<db_insert>insert into test_table values ( 2, 'asdf', 22 );</db_insert>
<queries>
<query mode="extended2" index="test1 test2" ranker="wordcount" sortmode="expr" sortby="@weight" index_weights="test1:10 test2:1">asdf</query>
<query mode="extended2" index="test1" index_weights="test1:11"></query>
<query mode="fullscan" index="test1" index_weights="test1:11"></query>
<query mode="fullscan" index="test1" index_weights="test1:11">something</query>
</queries>
<sphqueries>
<sphinxql>insert into test3 ( id, title ) values ( 1, 'asdf asdf asdf' )</sphinxql>
<sphinxql>insert into test4 ( id, title ) values ( 2, 'asdf' )</sphinxql>
<sphinxql>select id, weight() as skey from test3, test4 where match('asdf') option ranker=wordcount, index_weights=(test3=1, test4=10)</sphinxql>
<sphinxql>select id from test3 option index_weights=(test3=10)</sphinxql>
<!-- regression crash on reverse_scan -->
<sphinxql>select * from test_rs option reverse_scan=1</sphinxql>
<sphinxql>select * from test_rs where attr=22 option reverse_scan=1</sphinxql>
<sphinxql>select * from test_rs option reverse_scan=1, cutoff=1</sphinxql>
<sphinxql>select * from test_rs option cutoff=1</sphinxql>
</sphqueries>
</test>
|