<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_collection_ids(self, search_pattern="", identifier="", fetched=0, page=1):
 """ Fetches a list of resource URLs 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 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: Only records containing this identifier will be returned. Substring matching will not be performed; however, wildcards are supported. For example, searching "F1" will only return records with the identifier "F1", while searching "F*" will return "F1", "F2", etc. :return: A list containing every matched resource's URL. :rtype list: """

        params = {"page": page, "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)

        response = self._get(self.repository + "/search", params=params)
        hits = response.json()
        results = [r["uri"] for r in hits["results"]]

        results_so_far = fetched + hits["this_page"]
        if hits["total_hits"] > results_so_far:
            results.extend(
                self.find_collection_ids(fetched=results_so_far, page=page + 1)
            )

        return results