Closed amureki closed 7 years ago
I'm not sure that django-watson should try to support boolean query operators. Different databases have different capabilities, and there's room for great error trying to abstract it.
If you want to use more advanced searches, I'd consider using the new django postures-specific features directly.
On Wed, 19 Oct 2016 at 09:58 Rustem Sayargaliev notifications@github.com wrote:
Greetings @etianen https://github.com/etianen
Found that PostgreSQL that correctly works with + and - symbols in searching is not working in django-watson: RE_NON_WORD = re.compile(r'[:"(|)!><~*+-]', re.UNICODE) which is used in escape_query escapes it before PG performs search.
Maybe we should have base escape_query and for every backend have inheritor of this method with correct backend symbols?
What do you think about this approach? If it is valid for you, I can make a PR with tests.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/182, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCDGIYaM95xqa4KEsk6onE4Iwx6k8ks5q1dvLgaJpZM4KauJq .
@etianen nope, I not meant that these symbols should act as an operator.
https://www.postgresql.org/docs/9.1/static/functions-textsearch.html doesn't show +
and -
there.
The thing is, for example: test+test@example.com
is a valid email address and also valid search item for postgres ts_query.
But, because of RE_NON_WORD
MySQL escaping (which should not apply to a postgres backend at all), search in django-watson is not working for that kind of values.
Ah, I see your point. I'd certainly consider a better per-database query escaping a great pull request idea!
On Wed, 19 Oct 2016 at 13:05 Rustem Sayargaliev notifications@github.com wrote:
@etianen https://github.com/etianen nope, I not meant that these symbols should act as an operator. https://www.postgresql.org/docs/9.1/static/functions-textsearch.html doesn't show + and - there.
The thing is, for example: test+test@example.com is a valid email address and also valid search item for postgres ts_query. But, because of RE_NON_WORD MySQL escaping (which should not apply to a postgres backend at all), search in django-watson is not working for that kind of values.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/182#issuecomment-254793037, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCP8OR1NAAxsK-7VDdj0c6vAc2MoVks5q1geHgaJpZM4KauJq .
Greetings @etianen
Found that PostgreSQL that correctly works with
+
and-
symbols in searching is not working in django-watson:RE_NON_WORD = re.compile(r'[:"(|)!><~*+-]', re.UNICODE)
which is used inescape_query
escapes it before PG performs search.Maybe we should have base
escape_query
and for every backend have inheritor of this method with correct backend symbols?What do you think about this approach? If it is valid for you, I can make a PR with tests.