diff --git a/plone/app/querystring/profiles.zcml b/plone/app/querystring/profiles.zcml index f042058..9964d90 100644 --- a/plone/app/querystring/profiles.zcml +++ b/plone/app/querystring/profiles.zcml @@ -90,4 +90,12 @@ directory="profiles/upgrades/to_14" /> + + diff --git a/plone/app/querystring/profiles/default/metadata.xml b/plone/app/querystring/profiles/default/metadata.xml index 3949c2a..c8b58bc 100644 --- a/plone/app/querystring/profiles/default/metadata.xml +++ b/plone/app/querystring/profiles/default/metadata.xml @@ -1,6 +1,6 @@ - 14 + 15 profile-plone.app.registry:default diff --git a/plone/app/querystring/profiles/default/registry.xml b/plone/app/querystring/profiles/default/registry.xml index 24b3873..a3dd76a 100644 --- a/plone/app/querystring/profiles/default/registry.xml +++ b/plone/app/querystring/profiles/default/registry.xml @@ -242,6 +242,14 @@ plone.app.querystring.queryparser._contains StringWidget + + + Search + + plone.app.querystring.queryparser._search + StringWidget + False plone.app.querystring.operation.string.contains + plone.app.querystring.operation.string.search + + + Search + + plone.app.querystring.queryparser._search + StringWidget + + + + + plone.app.querystring.operation.string.search + + + diff --git a/plone/app/querystring/querybuilder.py b/plone/app/querystring/querybuilder.py index bd8978f..7401ca5 100644 --- a/plone/app/querystring/querybuilder.py +++ b/plone/app/querystring/querybuilder.py @@ -261,9 +261,14 @@ def number_of_results(self, query): def filter_query(self, query): text = query.get("SearchableText", None) + munge = True if isinstance(text, dict): + if text.get("operator", "") == "search": + munge = False + # catalog searches don't accept the operator key so remove it + del text["operator"] text = text.get("query", "") - if text: + if text and munge: query["SearchableText"] = self.munge_search_term(text) return query diff --git a/plone/app/querystring/queryparser.py b/plone/app/querystring/queryparser.py index 1f0a056..d587f47 100644 --- a/plone/app/querystring/queryparser.py +++ b/plone/app/querystring/queryparser.py @@ -110,6 +110,9 @@ def parseAndModifyFormquery(context, query, sort_on=None, sort_order=None): def _contains(context, row): return _equal(context, row) +def _search(context, row): + return {row.index: {'query': row.values, 'operator': 'search' }} + def _excludes(context, row): return {row.index: {"not": row.values}} diff --git a/plone/app/querystring/upgrades.zcml b/plone/app/querystring/upgrades.zcml index 07c2e23..1763c03 100644 --- a/plone/app/querystring/upgrades.zcml +++ b/plone/app/querystring/upgrades.zcml @@ -157,6 +157,16 @@ title="Add new 'string.isNot' and 'selection.none' query operators." import_profile="plone.app.querystring:upgrade_to_14" /> + + +