Complete the code to highlight the word 'database' in the text using ts_headline.
SELECT ts_headline('english', 'This is a database example.', [1]) AS highlighted_text;
The function ts_headline highlights the specified word in the text. Here, 'database' is the word to highlight.
Complete the code to highlight the phrase 'full text' in the given sentence.
SELECT ts_headline('english', 'This is a full text search example.', [1]) AS highlighted;
To highlight a phrase, use the tsquery syntax with & between words: 'full & text'.
Fix the error in the code to highlight the word 'search' correctly.
SELECT ts_headline('english', 'PostgreSQL full text search is powerful.', [1]) AS result;
The word to highlight must be a quoted string. Option C is missing quotes, causing an error.
Fill both blanks to highlight the word 'text' in the sentence using ts_headline with configuration 'english'.
SELECT ts_headline([1], 'This is a text search example.', [2]) AS highlighted;
The first argument is the text search configuration, here 'english'. The third argument is the word to highlight, 'text'.
Fill all three blanks to highlight the phrase 'full text' in the sentence using ts_headline with configuration 'english'.
SELECT ts_headline([1], 'This is a full text search example.', [2]) AS highlighted_text WHERE [3];
The first argument is the configuration 'english'. The second is the tsquery phrase 'full & text'. The WHERE clause uses 'true' to select all rows.