Updated views interface
authorThierry Florac <tflorac@ulthar.net>
Sun, 01 Jul 2018 08:55:45 +0200
changeset 71 a991347f4317
parent 70 228b4b58536f
child 72 1bfca7ed440b
Updated views interface
src/pyams_content_es/component/view.py
--- a/src/pyams_content_es/component/view.py	Thu Jun 28 09:26:40 2018 +0200
+++ b/src/pyams_content_es/component/view.py	Sun Jul 01 08:55:45 2018 +0200
@@ -61,16 +61,15 @@
                 params &= new_params
         return params
 
-    def get_results(self, context, limit=None):
-        view = self.context
+    def get_results(self, context, sort_index, reverse, limit):
         request = check_request()
         registry = request.registry
         client = get_client(request)
         params = self.get_es_params(context)
         search = Search(using=client.es, index=client.index) \
             .query(params) \
-            .sort('{0}workflow.{1}'.format('-' if view.reversed_order else '',
-                                           view.order_by)) \
+            .sort('{0}workflow.{1}'.format('-' if reverse else '',
+                                           sort_index)) \
             .source(['internal_id'])
         if limit:
             search = search[:limit]