0

I have a text search problem where I need to search systematically-generated text, i.e. not human-written natural language text.

The typical ts_tovector('english', 'foo bar baz') is not particularly helpful. In some cases it generates tokens which I know will be lead to false-positive search results.

Instead I'd really just like to either provide the tokens in a string where each token is separated by whitespace, or provide an array of ordered tokens.

For example, something along the lines of to_tsvector(array["foo", "bar", "baz"]) should produce three tokens: foo, bar, and baz. This seems like a pretty basic thing, but so far I haven't found any explicit documentation of this functionality.

1 Answer 1

2

This is indeed a basic thing, and all you have to do is use the simple text search configuration:

to_tsvector('simple', 'foo bar baz') 
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. I also found array_to_tsvector works nicely for taking an array of pre-computed tokens.
Ah, good. I have removed the misleading part of my answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.