1

Please help me to understand how to change words delimiter when I use gin index. The problem is that "," ";" and " " signs are words delimiters but the "." isn't. So in phrase "Some 11.22.33.44 IP" I am able to find "Some" "11.22.33.44" "IP" words. When I am looking for "33" - unable to find it. Many thanks for the help.

1 Answer 1

1

The "natural" way to do this would be to change or write your own text search parser. While it is possible to do that, it is unreasonably difficult.

Do you want both '11.22.33.44' and '33' to show up as individual tokes, or just '33'? If the latter, then maybe just preprocess your data by replacing all '.' with ' ':

replace(doc,'.',' ')

Of course you should do the same replacement on the queries as well before passing them to plainto_tsquery.

3
  • Thank you for response. I just want 11 22 33 44 to be separate words. I just have no idea why "." as end of the sentence isn't words separator. Mar 1, 2020 at 12:16
  • The "." you show is not at the end of a sentence.
    – jjanes
    Mar 1, 2020 at 13:55
  • Yes, sure. That's the point. I just want to change the behavior. Mar 3, 2020 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.