nodes: 0, module; 1, function_definition; 2, function_name:search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:q; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, expression_statement; 16, if_statement; 17, expression_statement; 18, if_statement; 19, if_statement; 20, if_statement; 21, if_statement; 22, if_statement; 23, return_statement; 24, identifier:t; 25, None; 26, identifier:focus; 27, None; 28, identifier:bbox; 29, None; 30, identifier:start; 31, integer:1; 32, identifier:num; 33, integer:10; 34, identifier:sortField; 35, None; 36, identifier:sortOrder; 37, string:"asc"; 38, identifier:useSecurity; 39, True; 40, comment:"""
          This operation searches for content items in the portal. The
          searches are performed against a high performance index that
          indexes the most popular fields of an item. See the Search
          reference page for information on the fields and the syntax of the
          query.
          The search index is updated whenever users add, update, or delete
          content. There can be a lag between the time that the content is
          updated and the time when it's reflected in the search results.
          The results of a search only contain items that the user has
          permission to access.
  
          Inputs:
             q - The query string used to search
             t - type of content to search for.
             focus - another content filter. Ex: files
             bbox - The bounding box for a spatial search defined as minx,
                    miny, maxx, or maxy. Search requires q, bbox, or both.
                    Spatial search is an overlaps/intersects function of the
                    query bbox and the extent of the document.
                    Documents that have no extent (e.g., mxds, 3dds, lyr)
                    will not be found when doing a bbox search.
                    Document extent is assumed to be in the WGS84 geographic
                    coordinate system.
             start -  The number of the first entry in the result set
                      response. The index number is 1-based.
                      The default value of start is 1 (that is, the first
                      search result).
                      The start parameter, along with the num parameter, can
                      be used to paginate the search results.
             num - The maximum number of results to be included in the result
                   set response.
                   The default value is 10, and the maximum allowed value is
                   100.
                   The start parameter, along with the num parameter, can be
                   used to paginate the search results.
             sortField - Field to sort by. You can also sort by multiple
                         fields (comma separated) for an item.
                         The allowed sort field names are title, created,
                         type, owner, modified, avgRating, numRatings,
                         numComments, and numViews.
             sortOrder - Describes whether the results return in ascending or
                         descending order. Default is ascending.
                         Values: asc | desc
             useSecurity - boolean value that determines if the security
                           handler object's token will be appended on the
                           search call.  If the value is set to False, then
                           the search will be performed without
                           authentication.  This means only items that have
                           been shared with everyone on AGOL or portal site
                           will be found.  If it is set to True, then all
                           items the user has permission to see based on the
                           query passed will be returned.
             Output:
               returns a list of dictionary
          """; 41, call; 42, block; 43, else_clause; 44, assignment; 45, not_operator; 46, block; 47, not_operator; 48, block; 49, boolean_operator; 50, block; 51, comparison_operator:sortField is not None; 52, block; 53, comparison_operator:bbox is not None; 54, block; 55, call; 56, attribute; 57, argument_list; 58, expression_statement; 59, block; 60, identifier:params; 61, dictionary; 62, comparison_operator:focus is None; 63, expression_statement; 64, comparison_operator:t is None; 65, expression_statement; 66, boolean_operator; 67, line_continuation:\; 68, comparison_operator:self._securityHandler.method == "token"; 69, expression_statement; 70, identifier:sortField; 71, None; 72, expression_statement; 73, identifier:bbox; 74, None; 75, expression_statement; 76, attribute; 77, argument_list; 78, attribute; 79, identifier:endswith; 80, string:"/rest"; 81, assignment; 82, expression_statement; 83, pair; 84, pair; 85, pair; 86, pair; 87, pair; 88, pair; 89, identifier:focus; 90, None; 91, assignment; 92, identifier:t; 93, None; 94, assignment; 95, identifier:useSecurity; 96, line_continuation:\; 97, comparison_operator:self._securityHandler is not None; 98, attribute; 99, string:"token"; 100, assignment; 101, assignment; 102, assignment; 103, identifier:self; 104, identifier:_get; 105, keyword_argument; 106, keyword_argument; 107, keyword_argument; 108, keyword_argument; 109, keyword_argument; 110, identifier:self; 111, identifier:_url; 112, identifier:url; 113, binary_operator:self._url + "/search"; 114, assignment; 115, string:"f"; 116, string:"json"; 117, string:"q"; 118, identifier:q; 119, string:"sortOrder"; 120, identifier:sortOrder; 121, string:"num"; 122, identifier:num; 123, string:"start"; 124, identifier:start; 125, string; 126, identifier:useSecurity; 127, subscript; 128, identifier:focus; 129, subscript; 130, identifier:t; 131, attribute; 132, None; 133, attribute; 134, identifier:method; 135, subscript; 136, attribute; 137, subscript; 138, identifier:sortField; 139, subscript; 140, identifier:bbox; 141, identifier:url; 142, identifier:url; 143, identifier:param_dict; 144, identifier:params; 145, identifier:securityHandler; 146, attribute; 147, identifier:proxy_url; 148, attribute; 149, identifier:proxy_port; 150, attribute; 151, attribute; 152, string:"/search"; 153, identifier:url; 154, binary_operator:self._url + "/rest/search"; 155, string_content:restrict; 156, identifier:params; 157, string; 158, identifier:params; 159, string; 160, identifier:self; 161, identifier:_securityHandler; 162, identifier:self; 163, identifier:_securityHandler; 164, identifier:params; 165, string:"token"; 166, attribute; 167, identifier:token; 168, identifier:params; 169, string; 170, identifier:params; 171, string; 172, identifier:self; 173, identifier:_securityHandler; 174, identifier:self; 175, identifier:_proxy_url; 176, identifier:self; 177, identifier:_proxy_port; 178, identifier:self; 179, identifier:_url; 180, attribute; 181, string:"/rest/search"; 182, string_content:focus; 183, string_content:t; 184, identifier:self; 185, identifier:_securityHandler; 186, string_content:sortField; 187, string_content:bbox; 188, identifier:self; 189, identifier:_url
code: def search(self,
                q,
                t=None,
                focus=None,
                bbox=None,
                start=1,
                num=10,
                sortField=None,
                sortOrder="asc",
                useSecurity=True):
          """
          This operation searches for content items in the portal. The
          searches are performed against a high performance index that
          indexes the most popular fields of an item. See the Search
          reference page for information on the fields and the syntax of the
          query.
          The search index is updated whenever users add, update, or delete
          content. There can be a lag between the time that the content is
          updated and the time when it's reflected in the search results.
          The results of a search only contain items that the user has
          permission to access.
  
          Inputs:
             q - The query string used to search
             t - type of content to search for.
             focus - another content filter. Ex: files
             bbox - The bounding box for a spatial search defined as minx,
                    miny, maxx, or maxy. Search requires q, bbox, or both.
                    Spatial search is an overlaps/intersects function of the
                    query bbox and the extent of the document.
                    Documents that have no extent (e.g., mxds, 3dds, lyr)
                    will not be found when doing a bbox search.
                    Document extent is assumed to be in the WGS84 geographic
                    coordinate system.
             start -  The number of the first entry in the result set
                      response. The index number is 1-based.
                      The default value of start is 1 (that is, the first
                      search result).
                      The start parameter, along with the num parameter, can
                      be used to paginate the search results.
             num - The maximum number of results to be included in the result
                   set response.
                   The default value is 10, and the maximum allowed value is
                   100.
                   The start parameter, along with the num parameter, can be
                   used to paginate the search results.
             sortField - Field to sort by. You can also sort by multiple
                         fields (comma separated) for an item.
                         The allowed sort field names are title, created,
                         type, owner, modified, avgRating, numRatings,
                         numComments, and numViews.
             sortOrder - Describes whether the results return in ascending or
                         descending order. Default is ascending.
                         Values: asc | desc
             useSecurity - boolean value that determines if the security
                           handler object's token will be appended on the
                           search call.  If the value is set to False, then
                           the search will be performed without
                           authentication.  This means only items that have
                           been shared with everyone on AGOL or portal site
                           will be found.  If it is set to True, then all
                           items the user has permission to see based on the
                           query passed will be returned.
             Output:
               returns a list of dictionary
          """
          if self._url.endswith("/rest"):
              url = self._url + "/search"
          else:
              url = self._url + "/rest/search"
  
          params = {
              "f" : "json",
              "q" : q,
              "sortOrder" : sortOrder,
              "num" : num,
              "start" : start,
              'restrict' : useSecurity
          }
          if not focus is None:
              params['focus'] = focus
          if not t is None:
              params['t'] = t
          if useSecurity and \
             self._securityHandler is not None and \
             self._securityHandler.method == "token":
              params["token"] = self._securityHandler.token
          if sortField is not None:
              params['sortField'] = sortField
          if bbox is not None:
              params['bbox'] = bbox
  
          return self._get(url=url,
                          param_dict=params,
                          securityHandler=self._securityHandler,
                          proxy_url=self._proxy_url,
                          proxy_port=self._proxy_port)