Пример #1
0
 def _parent_property_lookup(node):
     """given a node of the form `parent/foo = 'thing'`, return all case_ids where `foo = thing`
     """
     if isinstance(node.right, Step):
         _raise_step_RHS(node)
     new_query = "{} {} '{}'".format(serialize(node.left.right), node.op,
                                     node.right)
     es_query = CaseSearchES().domain(domain).xpath_query(domain, new_query)
     if es_query.count() > MAX_RELATED_CASES:
         raise CaseFilterError(
             _("The related case lookup you are trying to perform would return too many cases"
               ), new_query)
     return es_query.scroll_ids()
Пример #2
0
 def _parent_property_lookup(node):
     """given a node of the form `parent/foo = 'thing'`, return all case_ids where `foo = thing`
     """
     if isinstance(node.right, Step):
         _raise_step_RHS(node)
     new_query = "{} {} '{}'".format(serialize(node.left.right), node.op, node.right)
     es_query = CaseSearchES().domain(domain).xpath_query(domain, new_query)
     if es_query.count() > MAX_RELATED_CASES:
         raise CaseFilterError(
             _("The related case lookup you are trying to perform would return too many cases"),
             new_query
         )
     return es_query.scroll_ids()
Пример #3
0
    def _parent_property_lookup(node):
        """given a node of the form `parent/foo = 'thing'`, return all case_ids where `foo = thing`
        """
        es_filter = _comparison_raw(node.left.right, node.op, node.right, node)
        es_query = CaseSearchES().domain(context.domain).filter(es_filter)
        if es_query.count() > MAX_RELATED_CASES:
            new_query = '{} {} "{}"'.format(serialize(node.left.right),
                                            node.op, node.right)
            raise TooManyRelatedCasesError(
                _("The related case lookup you are trying to perform would return too many cases"
                  ), new_query)

        return es_query.scroll_ids()