2

I am using Postgres FTS to implement search. This is my sample tsvector:

{'analyst':2A 'busi':1A} 

The query I am using is

SELECT * FROM table_name WHERE tsv @@ to_tsquery('english', 'b:*') 

The result is showing correctly, but if I use 'a:*' instead of 'b:*',

SELECT * FROM table_name WHERE tsv @@ to_tsquery('english', 'a:*') 

The result is an empty set.

Is this some bug in PostgreSQL serach? I am using PostgreSQL version 12.6.

0

2 Answers 2

3

'a:' isn't a valid lexeme in English:

SELECT to_tsquery('english', 'a:') 

NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored

Sign up to request clarification or add additional context in comments.

Comments

2

'a' is a stopword, and to_tsquery removes it even if it already decorated with ':*'. I don't what the rationale for that is, it is not very intuitive to me.

So you will have to avoid the use of to_tsquery. You could instead do 'a:*'::tsquery.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.