Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In a query, || does not work when nested in <-> #119

Open
1Computer1 opened this issue Sep 23, 2023 · 3 comments
Open

In a query, || does not work when nested in <-> #119

1Computer1 opened this issue Sep 23, 2023 · 3 comments

Comments

@1Computer1
Copy link

The query (A || B) <-> C does not give any results, though it should be equivalent to (A <-> C) || (B <-> C), which does.
The built in GIN index can handle this case.
There may be other problems with ||, though I haven't looked too deep into it.

I'm using a rum_tsvector_addon_ops index attaching a float.

Thanks!

@obartunov
Copy link

obartunov commented Sep 23, 2023 via email

@1Computer1
Copy link
Author

Apologies, I couldn't reproduce it with a small set of data so this will be large file:
data.zip

Set up:

create extension rum;

create table documents (
    en text not null,
    score float not null
);

alter table documents
    add column textsearch_index_en_col tsvector
        generated always as (to_tsvector('english', en)) stored;

copy documents (en, score) from '/data.tsv' csv header delimiter E'\t';

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');

Queries:

select * from documents where textsearch_index_en_col @@ ('pet'::tsquery <-> ('dog'::tsquery || 'cat'::tsquery));
select * from documents where textsearch_index_en_col @@ (('pet'::tsquery <-> 'dog'::tsquery) || ('pet'::tsquery <-> 'cat'::tsquery));

@jeffjanes
Copy link

jeffjanes commented Sep 24, 2023 via email

1Computer1 added a commit to 1Computer1/sengenbango that referenced this issue Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants