... using an index of the rum_tsvector_addon_ops operator class
... it doesn't find anything.
Let's setup a test table with text values a a, a b, a c and so on.
create extension rum;
createtabletext_table (id1 serial, t text);
createtablerum_tbl (id serial, tsv tsvector);
insert into text_table(t) select chr(i) ||''|| chr(j) from generate_series(65,90) i, generate_series(65,90) j;
insert into rum_tbl(tsv) select to_tsvector('simple', t) from text_table;
Without any index we can query on a <-> b, which works like expected:
select*from rum_tbl where tsv @@ to_tsquery('simple', 'a <-> b');
id | tsv
----+-------------
2 | 'a':1 'b':2
(1 row)
Now let's create an index using the rum_tsvector_addon_ops operator class:
createindexrum_tbl_idx_addonon rum_tbl using rum (tsv rum_tsvector_addon_ops, id)
with (attach ='id', to ='tsv');
The same query now fails to return the matching row:
select*from rum_tbl where tsv @@ to_tsquery('simple', 'a <-> b');
id | tsv
----+-----
(0 rows)
Explain analyze says:
Bitmap Heap Scan on rum_tbl (cost=3.33..6.45 rows=4 width=28) (actual time=0.097..0.097 rows=0 loops=1)
Recheck Cond: (tsv @@ '''a'' <-> ''b'''::tsquery)
-> Bitmap Index Scan on rum_tbl_idx_addon (cost=0.00..3.33 rows=4 width=0) (actual time=0.093..0.093 rows=0 loop
s=1)
Index Cond: (tsv @@ '''a'' <-> ''b'''::tsquery)
A query using an AND operator works correctly:
select*from rum_tbl where tsv @@ to_tsquery('simple', 'a & b');
-- ... result has 2 rows
Interestingly, the phrase-query also works correctly if we only have a rum_tsvector_ops index:
dropindex rum_tbl_idx_addon;
createindexrum_tbl_idxon rum_tbl using rum (tsv rum_tsvector_ops);
select*from rum_tbl where tsv @@ to_tsquery('simple', 'a <-> b');
-- ... result has 1 row
Tested with PostgreSQL 11.5 and RUM 1.3.7.
Any help greatly appreciated. Thank you in advance!
The text was updated successfully, but these errors were encountered:
Hello, thank you for this great extension!
I think I've spotted some problem. When searching
foo <-> bar
rum_tsvector_addon_ops
operator classLet's setup a test table with text values
a a
,a b
,a c
and so on.Without any index we can query on
a <-> b
, which works like expected:Now let's create an index using the
rum_tsvector_addon_ops
operator class:The same query now fails to return the matching row:
Explain analyze says:
A query using an
AND
operator works correctly:Interestingly, the phrase-query also works correctly if we only have a
rum_tsvector_ops
index:Tested with PostgreSQL 11.5 and RUM 1.3.7.
Any help greatly appreciated. Thank you in advance!
The text was updated successfully, but these errors were encountered: