docs: def find_collections(
          self,
          search_pattern="",
          identifier="",
          fetched=0,
          page=1,
          page_size=30,
          sort_by=None,
      ):
          """
          Fetches a list of all resource IDs for every resource in the database.
  
          :param string search_pattern: A search pattern to use in looking up resources by title or resourceid.
              The search will match any title or resourceid containing this string;
              for example, "text" will match "this title has this text in it".
              If omitted, then all resources will be fetched.
          :param string identifier: Restrict records to only those with this identifier.
              This refers to the human-assigned record identifier, not the automatically generated internal ID.
              This value can contain wildcards.
  
          :return: A list containing every matched resource's ID.
          :rtype: list
          """
  
          def format_record(record):
              dates = self._fetch_dates_from_record(record)
              date_expression = self._fetch_date_expression_from_record(record)
              identifier = (
                  record["id_0"] if "id_0" in record else record.get("component_id", "")
              )
  
              has_children = (
                  len(
                      self._get(record["uri"] + "/tree", params={"page": 1}).json()[
                          "children"
                      ]
                  )
                  > 0
              )
  
              return {
                  "id": record["uri"],
                  "type": "resource",
                  "sortPosition": 1,
                  "identifier": identifier,
                  "title": record.get("title", ""),
                  "dates": dates,
                  "date_expression": date_expression,
                  "levelOfDescription": record["level"],
                  "children": [] if has_children else False,
                  "has_children": has_children,
                  "notes": self._format_notes(record),
              }
  
          params = {"page": page, "page_size": page_size, "q": "primary_type:resource"}
  
          if search_pattern != "":
              search_pattern = self._escape_solr_query(search_pattern, field="title")
              params["q"] = params["q"] + " AND title:{}".format(search_pattern)
  
          if identifier != "":
              identifier = self._escape_solr_query(identifier, field="identifier")
              params["q"] = params["q"] + " AND identifier:{}".format(identifier)
  
          if sort_by is not None:
              params["sort"] = "title_sort " + sort_by
  
          response = self._get(self.repository + "/search", params=params)
          hits = response.json()
          return [format_record(json.loads(r["json"])) for r in hits["results"]]