From 97ca6b195c509635a71a1bd1d15c0f24592e714d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 21 Mar 2019 12:32:06 +0100 Subject: Facet search: manage term containing = or | inside quotes --- ishtar_common/views_item.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ishtar_common/views_item.py') diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index 16128feba..ca75bffe1 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -390,14 +390,19 @@ def _parse_parentheses(s): FORBIDDEN_CHAR = [u":"] RESERVED_CHAR = [u"|", u"&"] +RE_FACET = re.compile('([-a-zA-Z]+)="([^"]+)"') def _parse_query_string(string, query_parameters, current_dct, exc_dct, extra_distinct_q): string = string.strip().lower() - if u"=" in string: - splited = string.split(u"=") + match = RE_FACET.search(string) + if match or u"=" in string: + if match: + splited = match.groups() + else: + splited = string.split(u"=") if len(splited) == 2: base_term, query = splited excluded = base_term.startswith(u"-") -- cgit v1.2.3