How to search hyphenated words in PostgreSQL full text search?
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?
postgresql full-text-search pattern-matching
add a comment |
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?
postgresql full-text-search pattern-matching
Assuming you run at least Postgres 9.6? (Please always declare your version of Postgres.)
– Erwin Brandstetter
Apr 21 '18 at 13:23
add a comment |
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?
postgresql full-text-search pattern-matching
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?
postgresql full-text-search pattern-matching
postgresql full-text-search pattern-matching
edited Apr 21 '18 at 23:36
Erwin Brandstetter
92.7k9176291
92.7k9176291
asked Apr 21 '18 at 7:45
user3098231user3098231
314
314
Assuming you run at least Postgres 9.6? (Please always declare your version of Postgres.)
– Erwin Brandstetter
Apr 21 '18 at 13:23
add a comment |
Assuming you run at least Postgres 9.6? (Please always declare your version of Postgres.)
– Erwin Brandstetter
Apr 21 '18 at 13:23
Assuming you run at least Postgres 9.6? (Please always declare your version of Postgres.)
– Erwin Brandstetter
Apr 21 '18 at 13:23
Assuming you run at least Postgres 9.6? (Please always declare your version of Postgres.)
– Erwin Brandstetter
Apr 21 '18 at 13:23
add a comment |
1 Answer
1
active
oldest
votes
The key word here is phrase search, introduced with Postgres 9.6.
Use the tsquery FOLLOWED BY operator <-> or one of the related <N> operators. Or better yet, use the function phraseto_tsquery() to generate your tsquery.
Quoting the manual, it ...
produces
tsquerythat searches for a phrase, ignoring punctuation
And:
phraseto_tsquerybehaves much likeplainto_tsquery, except that it
inserts the<->(FOLLOWED BY) operator between surviving words instead
of the&(AND) operator. Also, stop words are not simply discarded,
but are accounted for by inserting<N>operators rather than<->
operators. This function is useful when searching for exact lexeme
sequences, since the FOLLOWED BY operators check lexeme order not just
the presence of all the lexemes.
Your query would work like this:
select id
, ts_headline(content, phraseto_tsquery('english', 'good-morning')
, 'HighlightAll=true MaxFragments=100 FragmentDelimiter=$')
from tbl
where ts_content @@ phraseto_tsquery('english','good-morning');
phraseto_tsquery('english', 'good-morning') generates this tsquery:
'good-morn' <-> 'good' <-> 'morn'
Since "good-morning" is identified as asciihword (hyphenated ASCII word), the stemmed complete word is added before of each component. The manual:
It is possible for the parser to produce overlapping tokens from the
same piece of text. As an example, a hyphenated word will be reported
both as the entire word and as each component: (followed by an example)
to_tsvector() basically does the same on the other end, so everything matches up. This allows for fine-grained options with hyphenated words. The above only finds "good-morning" with a hyphen (or variants stemming to the same). To find all strings with "good" followed by "morn" (or variants stemming to the same) use phraseto_tsquery('english','good morning') generating this tsquery: 'good' <-> 'morn'
OTOH, you can enforce exact matches by adding another filter like:
...
AND content ~* 'good-morning' -- case insensitive regexp match
Or:
...
AND content ILIKE '%good-morning%'
Seems a bit redundant to the human eye, but this way you get fast full text index support and exact matches.
The latter is mostly equivalent, but different (fewer) characters have special meaning in the LIKE pattern and might need escaping. Related:
- PostgreSQL: Regular Expression escape function
- Pattern matching with LIKE, SIMILAR TO or regular expressions in PostgreSQL
Example to demonstrate the operator <N>:
phraseto_tsquery('english', 'Juliet and the Licks') generates this tsquery:
'juliet' <3> 'lick'
<3> meaning that lick must be the third lexeme after juliet.
Query:select id , ts_headline(content, phraseto_tsquery('english', 'rhus-t') , 'HighlightAll=true MaxFragments=100 FragmentDelimiter=$') from vqbooks where ts_content @@ phraseto_tsquery('english','rhus-t');result: " Lyss..,, Puls., <b>Rhus</b>-t., Sabad., " and " 'infant may have a <b>Rhus</b> toxicodendron picture. (NB: <b>Rhus</b>-t desires milk) I don't want to highlight have a <b>Rhus</b> toxicodendron". I want only first fragment to be highlighted.
– user3098231
Apr 26 '18 at 8:24
1
@user3098231: A small setting for the optionMaxFragmentsmight help some. But I am afraid that phrase search is not currently supported well ints_headline(). A bug has been reported. See: dba.stackexchange.com/q/204856/3684
– Erwin Brandstetter
Apr 26 '18 at 11:22
1
phraseto_tsquery('english', 'good-morning')produces'good-morn' <-> 'good' <-> 'morn', not'good' <-> 'morn'. How are you getting this result? (I'm on Postgres 10, windows)
– dtheodor
15 hours ago
@dtheodor: Good catch. I rectified the error and added proper information.
– Erwin Brandstetter
2 mins ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f204588%2fhow-to-search-hyphenated-words-in-postgresql-full-text-search%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The key word here is phrase search, introduced with Postgres 9.6.
Use the tsquery FOLLOWED BY operator <-> or one of the related <N> operators. Or better yet, use the function phraseto_tsquery() to generate your tsquery.
Quoting the manual, it ...
produces
tsquerythat searches for a phrase, ignoring punctuation
And:
phraseto_tsquerybehaves much likeplainto_tsquery, except that it
inserts the<->(FOLLOWED BY) operator between surviving words instead
of the&(AND) operator. Also, stop words are not simply discarded,
but are accounted for by inserting<N>operators rather than<->
operators. This function is useful when searching for exact lexeme
sequences, since the FOLLOWED BY operators check lexeme order not just
the presence of all the lexemes.
Your query would work like this:
select id
, ts_headline(content, phraseto_tsquery('english', 'good-morning')
, 'HighlightAll=true MaxFragments=100 FragmentDelimiter=$')
from tbl
where ts_content @@ phraseto_tsquery('english','good-morning');
phraseto_tsquery('english', 'good-morning') generates this tsquery:
'good-morn' <-> 'good' <-> 'morn'
Since "good-morning" is identified as asciihword (hyphenated ASCII word), the stemmed complete word is added before of each component. The manual:
It is possible for the parser to produce overlapping tokens from the
same piece of text. As an example, a hyphenated word will be reported
both as the entire word and as each component: (followed by an example)
to_tsvector() basically does the same on the other end, so everything matches up. This allows for fine-grained options with hyphenated words. The above only finds "good-morning" with a hyphen (or variants stemming to the same). To find all strings with "good" followed by "morn" (or variants stemming to the same) use phraseto_tsquery('english','good morning') generating this tsquery: 'good' <-> 'morn'
OTOH, you can enforce exact matches by adding another filter like:
...
AND content ~* 'good-morning' -- case insensitive regexp match
Or:
...
AND content ILIKE '%good-morning%'
Seems a bit redundant to the human eye, but this way you get fast full text index support and exact matches.
The latter is mostly equivalent, but different (fewer) characters have special meaning in the LIKE pattern and might need escaping. Related:
- PostgreSQL: Regular Expression escape function
- Pattern matching with LIKE, SIMILAR TO or regular expressions in PostgreSQL
Example to demonstrate the operator <N>:
phraseto_tsquery('english', 'Juliet and the Licks') generates this tsquery:
'juliet' <3> 'lick'
<3> meaning that lick must be the third lexeme after juliet.
Query:select id , ts_headline(content, phraseto_tsquery('english', 'rhus-t') , 'HighlightAll=true MaxFragments=100 FragmentDelimiter=$') from vqbooks where ts_content @@ phraseto_tsquery('english','rhus-t');result: " Lyss..,, Puls., <b>Rhus</b>-t., Sabad., " and " 'infant may have a <b>Rhus</b> toxicodendron picture. (NB: <b>Rhus</b>-t desires milk) I don't want to highlight have a <b>Rhus</b> toxicodendron". I want only first fragment to be highlighted.
– user3098231
Apr 26 '18 at 8:24
1
@user3098231: A small setting for the optionMaxFragmentsmight help some. But I am afraid that phrase search is not currently supported well ints_headline(). A bug has been reported. See: dba.stackexchange.com/q/204856/3684
– Erwin Brandstetter
Apr 26 '18 at 11:22
1
phraseto_tsquery('english', 'good-morning')produces'good-morn' <-> 'good' <-> 'morn', not'good' <-> 'morn'. How are you getting this result? (I'm on Postgres 10, windows)
– dtheodor
15 hours ago
@dtheodor: Good catch. I rectified the error and added proper information.
– Erwin Brandstetter
2 mins ago
add a comment |
The key word here is phrase search, introduced with Postgres 9.6.
Use the tsquery FOLLOWED BY operator <-> or one of the related <N> operators. Or better yet, use the function phraseto_tsquery() to generate your tsquery.
Quoting the manual, it ...
produces
tsquerythat searches for a phrase, ignoring punctuation
And:
phraseto_tsquerybehaves much likeplainto_tsquery, except that it
inserts the<->(FOLLOWED BY) operator between surviving words instead
of the&(AND) operator. Also, stop words are not simply discarded,
but are accounted for by inserting<N>operators rather than<->
operators. This function is useful when searching for exact lexeme
sequences, since the FOLLOWED BY operators check lexeme order not just
the presence of all the lexemes.
Your query would work like this:
select id
, ts_headline(content, phraseto_tsquery('english', 'good-morning')
, 'HighlightAll=true MaxFragments=100 FragmentDelimiter=$')
from tbl
where ts_content @@ phraseto_tsquery('english','good-morning');
phraseto_tsquery('english', 'good-morning') generates this tsquery:
'good-morn' <-> 'good' <-> 'morn'
Since "good-morning" is identified as asciihword (hyphenated ASCII word), the stemmed complete word is added before of each component. The manual:
It is possible for the parser to produce overlapping tokens from the
same piece of text. As an example, a hyphenated word will be reported
both as the entire word and as each component: (followed by an example)
to_tsvector() basically does the same on the other end, so everything matches up. This allows for fine-grained options with hyphenated words. The above only finds "good-morning" with a hyphen (or variants stemming to the same). To find all strings with "good" followed by "morn" (or variants stemming to the same) use phraseto_tsquery('english','good morning') generating this tsquery: 'good' <-> 'morn'
OTOH, you can enforce exact matches by adding another filter like:
...
AND content ~* 'good-morning' -- case insensitive regexp match
Or:
...
AND content ILIKE '%good-morning%'
Seems a bit redundant to the human eye, but this way you get fast full text index support and exact matches.
The latter is mostly equivalent, but different (fewer) characters have special meaning in the LIKE pattern and might need escaping. Related:
- PostgreSQL: Regular Expression escape function
- Pattern matching with LIKE, SIMILAR TO or regular expressions in PostgreSQL
Example to demonstrate the operator <N>:
phraseto_tsquery('english', 'Juliet and the Licks') generates this tsquery:
'juliet' <3> 'lick'
<3> meaning that lick must be the third lexeme after juliet.
Query:select id , ts_headline(content, phraseto_tsquery('english', 'rhus-t') , 'HighlightAll=true MaxFragments=100 FragmentDelimiter=$') from vqbooks where ts_content @@ phraseto_tsquery('english','rhus-t');result: " Lyss..,, Puls., <b>Rhus</b>-t., Sabad., " and " 'infant may have a <b>Rhus</b> toxicodendron picture. (NB: <b>Rhus</b>-t desires milk) I don't want to highlight have a <b>Rhus</b> toxicodendron". I want only first fragment to be highlighted.
– user3098231
Apr 26 '18 at 8:24
1
@user3098231: A small setting for the optionMaxFragmentsmight help some. But I am afraid that phrase search is not currently supported well ints_headline(). A bug has been reported. See: dba.stackexchange.com/q/204856/3684
– Erwin Brandstetter
Apr 26 '18 at 11:22
1
phraseto_tsquery('english', 'good-morning')produces'good-morn' <-> 'good' <-> 'morn', not'good' <-> 'morn'. How are you getting this result? (I'm on Postgres 10, windows)
– dtheodor
15 hours ago
@dtheodor: Good catch. I rectified the error and added proper information.
– Erwin Brandstetter
2 mins ago
add a comment |
The key word here is phrase search, introduced with Postgres 9.6.
Use the tsquery FOLLOWED BY operator <-> or one of the related <N> operators. Or better yet, use the function phraseto_tsquery() to generate your tsquery.
Quoting the manual, it ...
produces
tsquerythat searches for a phrase, ignoring punctuation
And:
phraseto_tsquerybehaves much likeplainto_tsquery, except that it
inserts the<->(FOLLOWED BY) operator between surviving words instead
of the&(AND) operator. Also, stop words are not simply discarded,
but are accounted for by inserting<N>operators rather than<->
operators. This function is useful when searching for exact lexeme
sequences, since the FOLLOWED BY operators check lexeme order not just
the presence of all the lexemes.
Your query would work like this:
select id
, ts_headline(content, phraseto_tsquery('english', 'good-morning')
, 'HighlightAll=true MaxFragments=100 FragmentDelimiter=$')
from tbl
where ts_content @@ phraseto_tsquery('english','good-morning');
phraseto_tsquery('english', 'good-morning') generates this tsquery:
'good-morn' <-> 'good' <-> 'morn'
Since "good-morning" is identified as asciihword (hyphenated ASCII word), the stemmed complete word is added before of each component. The manual:
It is possible for the parser to produce overlapping tokens from the
same piece of text. As an example, a hyphenated word will be reported
both as the entire word and as each component: (followed by an example)
to_tsvector() basically does the same on the other end, so everything matches up. This allows for fine-grained options with hyphenated words. The above only finds "good-morning" with a hyphen (or variants stemming to the same). To find all strings with "good" followed by "morn" (or variants stemming to the same) use phraseto_tsquery('english','good morning') generating this tsquery: 'good' <-> 'morn'
OTOH, you can enforce exact matches by adding another filter like:
...
AND content ~* 'good-morning' -- case insensitive regexp match
Or:
...
AND content ILIKE '%good-morning%'
Seems a bit redundant to the human eye, but this way you get fast full text index support and exact matches.
The latter is mostly equivalent, but different (fewer) characters have special meaning in the LIKE pattern and might need escaping. Related:
- PostgreSQL: Regular Expression escape function
- Pattern matching with LIKE, SIMILAR TO or regular expressions in PostgreSQL
Example to demonstrate the operator <N>:
phraseto_tsquery('english', 'Juliet and the Licks') generates this tsquery:
'juliet' <3> 'lick'
<3> meaning that lick must be the third lexeme after juliet.
The key word here is phrase search, introduced with Postgres 9.6.
Use the tsquery FOLLOWED BY operator <-> or one of the related <N> operators. Or better yet, use the function phraseto_tsquery() to generate your tsquery.
Quoting the manual, it ...
produces
tsquerythat searches for a phrase, ignoring punctuation
And:
phraseto_tsquerybehaves much likeplainto_tsquery, except that it
inserts the<->(FOLLOWED BY) operator between surviving words instead
of the&(AND) operator. Also, stop words are not simply discarded,
but are accounted for by inserting<N>operators rather than<->
operators. This function is useful when searching for exact lexeme
sequences, since the FOLLOWED BY operators check lexeme order not just
the presence of all the lexemes.
Your query would work like this:
select id
, ts_headline(content, phraseto_tsquery('english', 'good-morning')
, 'HighlightAll=true MaxFragments=100 FragmentDelimiter=$')
from tbl
where ts_content @@ phraseto_tsquery('english','good-morning');
phraseto_tsquery('english', 'good-morning') generates this tsquery:
'good-morn' <-> 'good' <-> 'morn'
Since "good-morning" is identified as asciihword (hyphenated ASCII word), the stemmed complete word is added before of each component. The manual:
It is possible for the parser to produce overlapping tokens from the
same piece of text. As an example, a hyphenated word will be reported
both as the entire word and as each component: (followed by an example)
to_tsvector() basically does the same on the other end, so everything matches up. This allows for fine-grained options with hyphenated words. The above only finds "good-morning" with a hyphen (or variants stemming to the same). To find all strings with "good" followed by "morn" (or variants stemming to the same) use phraseto_tsquery('english','good morning') generating this tsquery: 'good' <-> 'morn'
OTOH, you can enforce exact matches by adding another filter like:
...
AND content ~* 'good-morning' -- case insensitive regexp match
Or:
...
AND content ILIKE '%good-morning%'
Seems a bit redundant to the human eye, but this way you get fast full text index support and exact matches.
The latter is mostly equivalent, but different (fewer) characters have special meaning in the LIKE pattern and might need escaping. Related:
- PostgreSQL: Regular Expression escape function
- Pattern matching with LIKE, SIMILAR TO or regular expressions in PostgreSQL
Example to demonstrate the operator <N>:
phraseto_tsquery('english', 'Juliet and the Licks') generates this tsquery:
'juliet' <3> 'lick'
<3> meaning that lick must be the third lexeme after juliet.
edited 6 mins ago
answered Apr 21 '18 at 12:54
Erwin BrandstetterErwin Brandstetter
92.7k9176291
92.7k9176291
Query:select id , ts_headline(content, phraseto_tsquery('english', 'rhus-t') , 'HighlightAll=true MaxFragments=100 FragmentDelimiter=$') from vqbooks where ts_content @@ phraseto_tsquery('english','rhus-t');result: " Lyss..,, Puls., <b>Rhus</b>-t., Sabad., " and " 'infant may have a <b>Rhus</b> toxicodendron picture. (NB: <b>Rhus</b>-t desires milk) I don't want to highlight have a <b>Rhus</b> toxicodendron". I want only first fragment to be highlighted.
– user3098231
Apr 26 '18 at 8:24
1
@user3098231: A small setting for the optionMaxFragmentsmight help some. But I am afraid that phrase search is not currently supported well ints_headline(). A bug has been reported. See: dba.stackexchange.com/q/204856/3684
– Erwin Brandstetter
Apr 26 '18 at 11:22
1
phraseto_tsquery('english', 'good-morning')produces'good-morn' <-> 'good' <-> 'morn', not'good' <-> 'morn'. How are you getting this result? (I'm on Postgres 10, windows)
– dtheodor
15 hours ago
@dtheodor: Good catch. I rectified the error and added proper information.
– Erwin Brandstetter
2 mins ago
add a comment |
Query:select id , ts_headline(content, phraseto_tsquery('english', 'rhus-t') , 'HighlightAll=true MaxFragments=100 FragmentDelimiter=$') from vqbooks where ts_content @@ phraseto_tsquery('english','rhus-t');result: " Lyss..,, Puls., <b>Rhus</b>-t., Sabad., " and " 'infant may have a <b>Rhus</b> toxicodendron picture. (NB: <b>Rhus</b>-t desires milk) I don't want to highlight have a <b>Rhus</b> toxicodendron". I want only first fragment to be highlighted.
– user3098231
Apr 26 '18 at 8:24
1
@user3098231: A small setting for the optionMaxFragmentsmight help some. But I am afraid that phrase search is not currently supported well ints_headline(). A bug has been reported. See: dba.stackexchange.com/q/204856/3684
– Erwin Brandstetter
Apr 26 '18 at 11:22
1
phraseto_tsquery('english', 'good-morning')produces'good-morn' <-> 'good' <-> 'morn', not'good' <-> 'morn'. How are you getting this result? (I'm on Postgres 10, windows)
– dtheodor
15 hours ago
@dtheodor: Good catch. I rectified the error and added proper information.
– Erwin Brandstetter
2 mins ago
Query:
select id , ts_headline(content, phraseto_tsquery('english', 'rhus-t') , 'HighlightAll=true MaxFragments=100 FragmentDelimiter=$') from vqbooks where ts_content @@ phraseto_tsquery('english','rhus-t'); result: " Lyss..,, Puls., <b>Rhus</b>-t., Sabad., " and " 'infant may have a <b>Rhus</b> toxicodendron picture. (NB: <b>Rhus</b>-t desires milk) I don't want to highlight have a <b>Rhus</b> toxicodendron". I want only first fragment to be highlighted.– user3098231
Apr 26 '18 at 8:24
Query:
select id , ts_headline(content, phraseto_tsquery('english', 'rhus-t') , 'HighlightAll=true MaxFragments=100 FragmentDelimiter=$') from vqbooks where ts_content @@ phraseto_tsquery('english','rhus-t'); result: " Lyss..,, Puls., <b>Rhus</b>-t., Sabad., " and " 'infant may have a <b>Rhus</b> toxicodendron picture. (NB: <b>Rhus</b>-t desires milk) I don't want to highlight have a <b>Rhus</b> toxicodendron". I want only first fragment to be highlighted.– user3098231
Apr 26 '18 at 8:24
1
1
@user3098231: A small setting for the option
MaxFragments might help some. But I am afraid that phrase search is not currently supported well in ts_headline(). A bug has been reported. See: dba.stackexchange.com/q/204856/3684– Erwin Brandstetter
Apr 26 '18 at 11:22
@user3098231: A small setting for the option
MaxFragments might help some. But I am afraid that phrase search is not currently supported well in ts_headline(). A bug has been reported. See: dba.stackexchange.com/q/204856/3684– Erwin Brandstetter
Apr 26 '18 at 11:22
1
1
phraseto_tsquery('english', 'good-morning') produces 'good-morn' <-> 'good' <-> 'morn', not 'good' <-> 'morn'. How are you getting this result? (I'm on Postgres 10, windows)– dtheodor
15 hours ago
phraseto_tsquery('english', 'good-morning') produces 'good-morn' <-> 'good' <-> 'morn', not 'good' <-> 'morn'. How are you getting this result? (I'm on Postgres 10, windows)– dtheodor
15 hours ago
@dtheodor: Good catch. I rectified the error and added proper information.
– Erwin Brandstetter
2 mins ago
@dtheodor: Good catch. I rectified the error and added proper information.
– Erwin Brandstetter
2 mins ago
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f204588%2fhow-to-search-hyphenated-words-in-postgresql-full-text-search%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Assuming you run at least Postgres 9.6? (Please always declare your version of Postgres.)
– Erwin Brandstetter
Apr 21 '18 at 13:23