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

Phrase search fails with rum_tsvector_addon_ops #93

Closed
@ThomasWeiser

Description

@ThomasWeiser

Hello, thank you for this great extension!

I think I've spotted some problem. When searching

  • ... with a phrase-query likefoo <-> bar
  • ... using an index of therum_tsvector_addon_ops operator class
  • ... it doesn't find anything.

Let's setup a test table with text valuesa a,a b,a c and so on.

create extension rum;createtabletext_table (id1serial, ttext);createtablerum_tbl (idserial, 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 ona <-> b, which works like expected:

select*from rum_tblwhere tsv @@ to_tsquery('simple','a <-> b');
 id |     tsv     ----+-------------  2 | 'a':1 'b':2(1 row)

Now let's create an index using therum_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_tblwhere 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 loops=1)         Index Cond: (tsv @@ '''a'' <-> ''b'''::tsquery)

A query using anAND operator works correctly:

select*from rum_tblwhere tsv @@ to_tsquery('simple','a & b');-- ... result has 2 rows

Interestingly, the phrase-query also works correctly if we only have arum_tsvector_ops index:

dropindex rum_tbl_idx_addon;createindexrum_tbl_idxon rum_tbl using rum (tsv rum_tsvector_ops);select*from rum_tblwhere 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp