equal
deleted
inserted
replaced
27 |
27 |
28 weight = 10 |
28 weight = 10 |
29 |
29 |
30 def get_es_params(self, context): |
30 def get_es_params(self, context): |
31 settings = IViewInternalReferencesSettings(self.context) |
31 settings = IViewInternalReferencesSettings(self.context) |
32 # check view references mode |
|
33 query = None |
|
34 if settings.references_mode == ONLY_REFERENCE_MODE: |
|
35 query = Q('terms', **{'reference_id': settings.references}) |
|
36 # check view settings |
32 # check view settings |
37 if settings.exclude_context: |
33 if settings.exclude_context: |
38 intids = get_utility(IIntIds) |
34 intids = get_utility(IIntIds) |
39 context_query = Q('bool', must_not=Q('term', internal_id=intids.register(context))) |
35 yield Q('bool', must_not=Q('term', internal_id=intids.register(context))) |
40 if query is None: |
36 # check view references mode |
41 query = context_query |
37 if settings.references_mode == ONLY_REFERENCE_MODE: |
42 else: |
38 yield Q('terms', **{'reference_id': settings.references}), False |
43 query &= context_query |
|
44 return query, settings.references_mode != ONLY_REFERENCE_MODE |
|