Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"it's" changing to "its" #14

Closed
soheilpro opened this issue Jul 13, 2021 · 4 comments
Closed

"it's" changing to "its" #14

soheilpro opened this issue Jul 13, 2021 · 4 comments

Comments

@soheilpro
Copy link

Hi,

Parsing it's returns its.

Is there any way to make it return it&s instead?

@caub
Copy link
Owner

caub commented Jul 13, 2021

Hi, oh good point, I think recently we had to do this https://github.com/caub/pg-tsquery/blob/master/index.js#L220 where we replace single quotes by an empty string

We could make the replacement configurable m.groups.word.replace(/'/g, this.singleQuoteReplacer || '') or something

If you have a bit more time that I, maybe make a PR with quicks tests

@soheilpro
Copy link
Author

Thanks for your quick response. I'll wait for the fix as it's not very critical.

@caub
Copy link
Owner

caub commented Jul 27, 2021

Ok now the option is added, you could do

const tsquery = Tsquery({singleQuoteReplacement: '&'});
tsquery(`It's working`)+'' // It&s&working`

note that if you use {singleQuoteReplacement: ' ' for example, the result would probably make postgresql ts_query crash

@soheilpro
Copy link
Author

Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants