Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit727d692

Browse files
committed
Test for correct work of phrase operator in index where position
information is not added.
1 parentdccdc8e commit727d692

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

‎expected/rum.out

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,24 @@ SELECT (a <=> to_tsquery('pg_catalog.english', 'b:*'))::numeric(10,4) AS distanc
381381
16.4493 | the few that escaped destruction in 1693. It is a beautiful, highly | '1693':7 'beauti':11 'destruct':5 'escap':4 'high':12
382382
(20 rows)
383383

384+
-- Test correct work of phrase operator when position information is not in index.
385+
create table test_rum_addon as table test_rum;
386+
alter table test_rum_addon add column id serial;
387+
create index on test_rum_addon using rum (a rum_tsvector_addon_ops, id) with (attach = 'id', to='a');
388+
select * from test_rum_addon where a @@ to_tsquery('pg_catalog.english', 'half <-> way');
389+
t | a | id
390+
---------------------------------------------------------------------+---------------------------------------------------------+----
391+
itself. Put on your "specs" and look at the castle, half way up the | 'castl':10 'half':11 'look':7 'put':2 'spec':5 'way':12 | 9
392+
(1 row)
393+
394+
explain (costs off) select * from test_rum_addon where a @@ to_tsquery('pg_catalog.english', 'half <-> way');
395+
QUERY PLAN
396+
------------------------------------------------------------
397+
Index Scan using test_rum_addon_a_id_idx on test_rum_addon
398+
Index Cond: (a @@ '''half'' <-> ''way'''::tsquery)
399+
(2 rows)
400+
401+
--
384402
select ('bjarn:6237 stroustrup:6238'::tsvector <=> 'bjarn <-> stroustrup'::tsquery)::numeric(10,5) AS distance;
385403
distance
386404
----------

‎sql/rum.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,14 @@ SELECT (a <=> to_tsquery('pg_catalog.english', 'b:*'))::numeric(10,4) AS distanc
141141
WHERE a @@ to_tsquery('pg_catalog.english','b:*')
142142
ORDER BY a<=> to_tsquery('pg_catalog.english','b:*');
143143

144+
-- Test correct work of phrase operator when position information is not in index.
145+
createtabletest_rum_addonas table test_rum;
146+
altertable test_rum_addon add column idserial;
147+
createindexon test_rum_addon using rum (a rum_tsvector_addon_ops, id) with (attach='id', to='a');
148+
149+
select*from test_rum_addonwhere a @@ to_tsquery('pg_catalog.english','half <-> way');
150+
explain (costs off)select*from test_rum_addonwhere a @@ to_tsquery('pg_catalog.english','half <-> way');
151+
--
152+
144153
select ('bjarn:6237 stroustrup:6238'::tsvector<=>'bjarn <-> stroustrup'::tsquery)::numeric(10,5)AS distance;
145154
SELECT ('stroustrup:5508B,6233B,6238B bjarn:6235B,6237B'<=>'bjarn <-> stroustrup'::tsquery)::numeric(10,5)AS distance;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp