@@ -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+ --
384402select ('bjarn:6237 stroustrup:6238'::tsvector <=> 'bjarn <-> stroustrup'::tsquery)::numeric(10,5) AS distance;
385403 distance
386404----------