Skip to content

Commit e00f528

Browse files
authored
add rum test (#1169)
1 parent 263230d commit e00f528

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

nix/tests/expected/rum.out

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
create schema v;
2+
create table v.test_rum(
3+
t text,
4+
a tsvector
5+
);
6+
create trigger tsvectorupdate
7+
before update or insert on v.test_rum
8+
for each row
9+
execute procedure
10+
tsvector_update_trigger(
11+
'a',
12+
'pg_catalog.english',
13+
't'
14+
);
15+
insert into v.test_rum(t)
16+
values
17+
('the situation is most beautiful'),
18+
('it is a beautiful'),
19+
('it looks like a beautiful place');
20+
create index rumidx on v.test_rum using rum (a rum_tsvector_ops);
21+
select
22+
t,
23+
a <=> to_tsquery('english', 'beautiful | place') as rank
24+
from
25+
v.test_rum
26+
where
27+
a @@ to_tsquery('english', 'beautiful | place')
28+
order by
29+
a <=> to_tsquery('english', 'beautiful | place');
30+
t | rank
31+
---------------------------------+----------
32+
it looks like a beautiful place | 8.22467
33+
the situation is most beautiful | 16.44934
34+
it is a beautiful | 16.44934
35+
(3 rows)
36+
37+
drop schema v cascade;
38+
NOTICE: drop cascades to table v.test_rum

nix/tests/sql/rum.sql

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
create schema v;
2+
3+
create table v.test_rum(
4+
t text,
5+
a tsvector
6+
);
7+
8+
create trigger tsvectorupdate
9+
before update or insert on v.test_rum
10+
for each row
11+
execute procedure
12+
tsvector_update_trigger(
13+
'a',
14+
'pg_catalog.english',
15+
't'
16+
);
17+
18+
insert into v.test_rum(t)
19+
values
20+
('the situation is most beautiful'),
21+
('it is a beautiful'),
22+
('it looks like a beautiful place');
23+
24+
create index rumidx on v.test_rum using rum (a rum_tsvector_ops);
25+
26+
select
27+
t,
28+
a <=> to_tsquery('english', 'beautiful | place') as rank
29+
from
30+
v.test_rum
31+
where
32+
a @@ to_tsquery('english', 'beautiful | place')
33+
order by
34+
a <=> to_tsquery('english', 'beautiful | place');
35+
36+
37+
drop schema v cascade;

0 commit comments

Comments
 (0)