--- a/src/pyams_content_es/root/zmi/search.py Mon Jul 20 10:42:33 2020 +0200
+++ b/src/pyams_content_es/root/zmi/search.py Mon Jul 20 12:33:08 2020 +0200
@@ -70,6 +70,10 @@
fields['fulltext'].widgetFactory = SingleCheckBoxFieldWidget
return fields
+ @property
+ def sort_results(self):
+ return not bool(self.request.params.get('search_form.widgets.query'))
+
@adapter_config(context=(ISiteRoot, IPyAMSLayer, SiteRootAdvancedSearchView),
provides=ISearchFormFactory)
--- a/src/pyams_content_es/shared/zmi/search.py Mon Jul 20 10:42:33 2020 +0200
+++ b/src/pyams_content_es/shared/zmi/search.py Mon Jul 20 12:33:08 2020 +0200
@@ -15,6 +15,7 @@
"""
from elasticsearch_dsl import Q, Search
+from pyramid.decorator import reify
from pyramid_es import get_client
from z3c.form.browser.checkbox import SingleCheckBoxFieldWidget
from zope.dublincore.interfaces import IZopeDublinCore
@@ -72,6 +73,10 @@
fields['fulltext'].widgetFactory = SingleCheckBoxFieldWidget
return fields
+ @reify
+ def sort_results(self):
+ return not bool(self.request.params.get('search_form.widgets.query'))
+
@adapter_config(context=(IBaseSharedTool, IPyAMSLayer, SharedToolAdvancedSearchView),
provides=ISearchFormFactory)