nodes: 0, module; 1, function_definition; 2, function_name:query_search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:search_query; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, assert_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, expression_statement; 16, if_statement; 17, identifier:sort; 18, None; 19, identifier:offset; 20, integer:100; 21, identifier:page; 22, integer:1; 23, comment:"""
          Search using a query.
  
          Currently implemented is the MongoDB query model to search for documents according to:
          https://docs.mongodb.com/manual/tutorial/query-documents/
  
          And an Elastic Search driver, which implements a basic parser to convert the query into
          elastic search format.
  
          Example: query_search({"price":[0,10]})
  
          :param search_query: Python dictionary, query following mongodb syntax
          :param sort: 1/-1 to sort ascending or descending.
          :param offset: Integer with the number of elements displayed per page.
          :param page: Integer with the number of page.
          :return: List of DDO instance
          """; 24, comparison_operator:page >= 1; 25, string; 26, assignment; 27, assignment; 28, assignment; 29, assignment; 30, comparison_operator:response.status_code == 200; 31, block; 32, else_clause; 33, identifier:page; 34, integer:1; 35, string_content:Invalid page value; 36, interpolation; 37, string_content:. Required page >= 1.; 38, subscript; 39, identifier:sort; 40, subscript; 41, identifier:offset; 42, subscript; 43, identifier:page; 44, identifier:response; 45, call; 46, attribute; 47, integer:200; 48, return_statement; 49, block; 50, identifier:page; 51, identifier:search_query; 52, string; 53, identifier:search_query; 54, string; 55, identifier:search_query; 56, string; 57, attribute; 58, argument_list; 59, identifier:response; 60, identifier:status_code; 61, call; 62, raise_statement; 63, string_content:sort; 64, string_content:offset; 65, string_content:page; 66, attribute; 67, identifier:post; 68, string; 69, keyword_argument; 70, keyword_argument; 71, attribute; 72, argument_list; 73, call; 74, identifier:self; 75, identifier:requests_session; 76, interpolation; 77, string_content:/query; 78, identifier:data; 79, call; 80, identifier:headers; 81, attribute; 82, identifier:self; 83, identifier:_parse_search_response; 84, attribute; 85, identifier:Exception; 86, argument_list; 87, attribute; 88, attribute; 89, argument_list; 90, identifier:self; 91, identifier:_headers; 92, identifier:response; 93, identifier:content; 94, string; 95, identifier:self; 96, identifier:url; 97, identifier:json; 98, identifier:dumps; 99, identifier:search_query; 100, string_content:Unable to search for DDO:; 101, interpolation; 102, attribute; 103, identifier:response; 104, identifier:content
code: def query_search(self, search_query, sort=None, offset=100, page=1):
          """
          Search using a query.
  
          Currently implemented is the MongoDB query model to search for documents according to:
          https://docs.mongodb.com/manual/tutorial/query-documents/
  
          And an Elastic Search driver, which implements a basic parser to convert the query into
          elastic search format.
  
          Example: query_search({"price":[0,10]})
  
          :param search_query: Python dictionary, query following mongodb syntax
          :param sort: 1/-1 to sort ascending or descending.
          :param offset: Integer with the number of elements displayed per page.
          :param page: Integer with the number of page.
          :return: List of DDO instance
          """
          assert page >= 1, f'Invalid page value {page}. Required page >= 1.'
          search_query['sort'] = sort
          search_query['offset'] = offset
          search_query['page'] = page
          response = self.requests_session.post(
              f'{self.url}/query',
              data=json.dumps(search_query),
              headers=self._headers
          )
          if response.status_code == 200:
              return self._parse_search_response(response.content)
          else:
              raise Exception(f'Unable to search for DDO: {response.content}')