How to search hyphenated words in PostgreSQL full text search?
12
votes
1
answer
7605
views
I have to search for hyphenated words like 'good-morning', 'good-evening', etc.
My query is:
select id, ts_headline(content,
to_tsquery('english','good-morning'),
'HighlightAll=true MaxFragments=100 FragmentDelimiter=$')
from table
where ts_content @@ to_tsquery('english','good-morning');
When executing this query I also get results of *'good'* and *'morning'* separately. But I want exactly matching words and fragments.
(For
ts_content
I used the same default config english
to create the tsvector
.)
How can I search such hyphenated words in PostgreSQL full text search?
Asked by user3098231
(131 rep)
Apr 21, 2018, 07:45 AM
Last activity: Aug 1, 2023, 06:11 PM
Last activity: Aug 1, 2023, 06:11 PM