Complete the code to convert the text 'Hello world' into a tsvector.
SELECT to_tsvector([1]);The to_tsvector function converts a text string into a tsvector. Here, we pass the text directly.
Complete the code to convert the text 'The quick brown fox' using the English text search configuration.
SELECT to_tsvector([1], 'The quick brown fox');
Using 'english' as the configuration applies English language rules for text search.
Fix the error in the code to convert the text 'Cats and dogs' into a tsvector using the simple configuration.
SELECT to_tsvector([1] 'Cats and dogs');
The language configuration and the text must be separated by a comma. Here, adding a comma after 'simple' fixes the syntax.
Fill both blanks to convert the text 'PostgreSQL is great' using the English configuration and alias the result as 'document'.
SELECT to_tsvector([1], [2]) AS document;
The first blank is the language configuration 'english', and the second blank is the text to convert.
Fill all three blanks to create a query that converts the text 'I love databases' using the simple configuration, and filters results where the tsvector contains 'love'.
SELECT to_tsvector([1], [2]) AS doc_vector WHERE to_tsvector([1], [2]) @@ to_tsquery([1], [3]);
to_tsvector and to_tsquery.The first blank is the configuration 'simple', the second is the text, and the third is the query term 'love' used in to_tsquery to filter the tsvector.