Updated default sort order
authorThierry Florac <tflorac@ulthar.net>
Wed, 19 Dec 2018 10:40:42 +0100
changeset 1186 1cefd3e1ba43
parent 1185 944a3e4a78ab
child 1187 b55bdf60c6cd
Updated default sort order
src/pyams_content/features/search/portlet/__init__.py
--- a/src/pyams_content/features/search/portlet/__init__.py	Tue Dec 18 16:58:03 2018 +0100
+++ b/src/pyams_content/features/search/portlet/__init__.py	Wed Dec 19 10:40:42 2018 +0100
@@ -17,6 +17,7 @@
 
 from zope.schema.fieldproperty import FieldProperty
 
+from pyams_content import _
 from pyams_content.features.search import ISearchFolder
 from pyams_content.features.search.portlet.interfaces import ISearchResultsPortletSettings
 from pyams_content.shared.view.interfaces import RELEVANCE_ORDER
@@ -26,8 +27,6 @@
 from pyams_utils.request import check_request
 from pyams_utils.traversing import get_parent
 
-from pyams_content import _
-
 
 SEARCH_RESULTS_PORTLET_NAME = 'pyams_content.portlet.search.results'
 
@@ -47,7 +46,7 @@
             if request is None:
                 request = check_request()
             params = request.params
-            sort_index = params.get('order_by', RELEVANCE_ORDER)
+            sort_index = params.get('order_by', context.order_by)
             yield from context.get_results(context, sort_index,
                                            reverse=sort_index != RELEVANCE_ORDER,
                                            limit=limit,