mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-30 01:46:24 +01:00
moving tsvector query sanitation to
This commit is contained in:
parent
be02bcef3c
commit
8fa7a41011
@ -228,9 +228,7 @@ class PostgresSearchQueryCompiler(BaseSearchQueryCompiler):
|
||||
return self.get_search_field(sub_field_name, field.fields)
|
||||
|
||||
def prepare_word(self, word):
|
||||
# remove backslash from string to prevent syntax error in tsquery
|
||||
stripped_word = word.replace("\\", "")
|
||||
return unidecode(stripped_word)
|
||||
return unidecode(word)
|
||||
|
||||
def build_tsquery_content(self, query, group=False):
|
||||
if isinstance(query, PlainText):
|
||||
|
@ -18,7 +18,8 @@ class RawSearchQuery(SearchQuery):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def as_sql(self, compiler, connection):
|
||||
params = [v.replace("'", "''") for v in self.value]
|
||||
# escape apostrophe and backslash
|
||||
params = [v.replace("'", "''").replace("\\", "\\\\") for v in self.value]
|
||||
if self.config:
|
||||
config_sql, config_params = compiler.compile(self.config)
|
||||
template = "to_tsquery(%s::regconfig, '%s')" % (config_sql, self.format)
|
||||
|
Loading…
Reference in New Issue
Block a user