File tree Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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;
You can’t perform that action at this time.
0 commit comments