1drop table if exists t1;
2flush status;
3create table t1 (
4c1 int primary key,
5c2 int,
6c3 text,
7key idx1(c2),
8fulltext index ft(c3)
9) comment = 'engine "innodb"';
10insert into t1 values(1,10,"aa ii uu ee oo");
11insert into t1 values(2,20,"ka ki ku ke ko");
12insert into t1 values(3,30,"ii si ii se ii");
13insert into t1 values(4,40,"ta ti tu te to");
14insert into t1 values(5,50,"aa ii uu ii oo");
15select c3, match(c3) against("ii") from t1
16where match(c3) against("ii") order by match(c3) against("ii") desc;
17c3	match(c3) against("ii")
18ii si ii se ii	524289
19aa ii uu ii oo	349526
20aa ii uu ee oo	174763
21show status like 'mroonga_fast_order_limit';
22Variable_name	Value
23Mroonga_fast_order_limit	0
24select c3, match(c3) against("ii") from t1
25where match(c3) against("ii") order by match(c3) against("ii") desc limit 1, 1;
26c3	match(c3) against("ii")
27aa ii uu ii oo	349526
28show status like 'mroonga_fast_order_limit';
29Variable_name	Value
30Mroonga_fast_order_limit	1
31select c3, match(c3) against("ii") from t1
32where match(c3) against("ii") order by match(c3) against("ii");
33c3	match(c3) against("ii")
34aa ii uu ee oo	174763
35aa ii uu ii oo	349526
36ii si ii se ii	524289
37show status like 'mroonga_fast_order_limit';
38Variable_name	Value
39Mroonga_fast_order_limit	1
40select c3, match(c3) against("ii") from t1
41where match(c3) against("ii") order by match(c3) against("ii") limit 1;
42c3	match(c3) against("ii")
43aa ii uu ee oo	174763
44show status like 'mroonga_fast_order_limit';
45Variable_name	Value
46Mroonga_fast_order_limit	2
47select count(*) from t1 where match(c3) against("ii") limit 1;
48count(*)
493
50show status like 'mroonga_fast_order_limit';
51Variable_name	Value
52Mroonga_fast_order_limit	2
53drop table t1;
54