docs: def search(self, read_cache=True, **kwparams):
          """
          Returns records corresponding to the given search query.
  
          See docstring of invenio.legacy.search_engine.perform_request_search()
          for an overview of available parameters.
  
          @raise InvenioConnectorAuthError: if authentication fails
          """
          parse_results = False
          of = kwparams.get('of', "")
          if of == "":
              parse_results = True
              of = "xm"
              kwparams['of'] = of
          params = urllib.urlencode(kwparams, doseq=1)
  
          # Are we running locally? If so, better directly access the
          # search engine directly
          if self.local and of != 't':
              # See if user tries to search any restricted collection
              c = kwparams.get('c', "")
              if c != "":
                  if type(c) is list:
                      colls = c
                  else:
                      colls = [c]
                  for collection in colls:
                      if collection_restricted_p(collection):
                          if self.user:
                              self._check_credentials()
                              continue
                          raise InvenioConnectorAuthError("You are trying to search a restricted collection. Please authenticate yourself.\n")
              kwparams['of'] = 'id'
              results = perform_request_search(**kwparams)
              if of.lower() != 'id':
                  results = format_records(results, of)
          else:
              if params + str(parse_results) not in self.cached_queries or not read_cache:
                  if self.user:
                      results = self.browser.open(self.server_url + "/search?" + params)
                  else:
                      results = urllib2.urlopen(self.server_url + "/search?" + params)
                  if 'youraccount/login' in results.geturl():
                      # Current user not able to search collection
                      raise InvenioConnectorAuthError("You are trying to search a restricted collection. Please authenticate yourself.\n")
              else:
                  return self.cached_queries[params + str(parse_results)]
  
          if parse_results:
              # FIXME: we should not try to parse if results is string
              parsed_records = self._parse_results(results, self.cached_records)
              self.cached_queries[params + str(parse_results)] = parsed_records
              return parsed_records
          else:
              # pylint: disable=E1103
              # The whole point of the following code is to make sure we can
              # handle two types of variable.
              try:
                  res = results.read()
              except AttributeError:
                  res = results
              # pylint: enable=E1103
  
              if of == "id":
                  try:
                      if type(res) is str:
                          # Transform to list
                          res = [int(recid.strip()) for recid in \
                          res.strip("[]").split(",") if recid.strip() != ""]
                      res.reverse()
                  except (ValueError, AttributeError):
                      res = []
              self.cached_queries[params + str(parse_results)] = res
              return self.cached_queries[params + str(parse_results)]