- Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathexpr.out
26 lines (24 loc) · 1.11 KB
/
expr.out
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
CREATE TABLE documents (
en text not null,
score float not null,
textsearch_index_en_col tsvector
);
INSERT INTO documents VALUES ('the pet cat is in the shed', 56, to_tsvector('english', 'the pet cat is in the shed'));
CREATE INDEX textsearch_index_en ON documents
USING rum (textsearch_index_en_col rum_tsvector_addon_ops, score)
WITH (attach = 'score', to = 'textsearch_index_en_col');
SET enable_seqscan=off;
-- should be 1 row
SELECT * FROM documents WHERE textsearch_index_en_col @@ ('pet'::tsquery <-> ('dog'::tsquery || 'cat'::tsquery));
en | score | textsearch_index_en_col
----------------------------+-------+--------------------------
the pet cat is in the shed | 56 | 'cat':3 'pet':2 'shed':7
(1 row)
SET enable_seqscan=on;
-- 1 row
SELECT * FROM documents WHERE textsearch_index_en_col @@ ('pet'::tsquery <-> ('dog'::tsquery || 'cat'::tsquery));
en | score | textsearch_index_en_col
----------------------------+-------+--------------------------
the pet cat is in the shed | 56 | 'cat':3 'pet':2 'shed':7
(1 row)
DROP TABLE documents;