From 20ddb504a2334ed0ca7e7ec5d5f90f89c7426369 Mon Sep 17 00:00:00 2001 From: Oliver Rice Date: Fri, 23 Aug 2024 10:52:12 -0500 Subject: [PATCH] add rum test --- nix/tests/expected/rum.out | 38 ++++++++++++++++++++++++++++++++++++++ nix/tests/sql/rum.sql | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 nix/tests/expected/rum.out create mode 100644 nix/tests/sql/rum.sql diff --git a/nix/tests/expected/rum.out b/nix/tests/expected/rum.out new file mode 100644 index 000000000..ba8a40264 --- /dev/null +++ b/nix/tests/expected/rum.out @@ -0,0 +1,38 @@ +create schema v; +create table v.test_rum( + t text, + a tsvector +); +create trigger tsvectorupdate + before update or insert on v.test_rum + for each row + execute procedure + tsvector_update_trigger( + 'a', + 'pg_catalog.english', + 't' + ); +insert into v.test_rum(t) +values + ('the situation is most beautiful'), + ('it is a beautiful'), + ('it looks like a beautiful place'); +create index rumidx on v.test_rum using rum (a rum_tsvector_ops); +select + t, + a <=> to_tsquery('english', 'beautiful | place') as rank +from + v.test_rum +where + a @@ to_tsquery('english', 'beautiful | place') +order by + a <=> to_tsquery('english', 'beautiful | place'); + t | rank +---------------------------------+---------- + it looks like a beautiful place | 8.22467 + the situation is most beautiful | 16.44934 + it is a beautiful | 16.44934 +(3 rows) + +drop schema v cascade; +NOTICE: drop cascades to table v.test_rum diff --git a/nix/tests/sql/rum.sql b/nix/tests/sql/rum.sql new file mode 100644 index 000000000..4686c1245 --- /dev/null +++ b/nix/tests/sql/rum.sql @@ -0,0 +1,37 @@ +create schema v; + +create table v.test_rum( + t text, + a tsvector +); + +create trigger tsvectorupdate + before update or insert on v.test_rum + for each row + execute procedure + tsvector_update_trigger( + 'a', + 'pg_catalog.english', + 't' + ); + +insert into v.test_rum(t) +values + ('the situation is most beautiful'), + ('it is a beautiful'), + ('it looks like a beautiful place'); + +create index rumidx on v.test_rum using rum (a rum_tsvector_ops); + +select + t, + a <=> to_tsquery('english', 'beautiful | place') as rank +from + v.test_rum +where + a @@ to_tsquery('english', 'beautiful | place') +order by + a <=> to_tsquery('english', 'beautiful | place'); + + +drop schema v cascade;