def find_collection_ids(
        self, search_pattern="", identifier="", page=None, page_size=30
    ):
        """
        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.
            Unlike the ArchivesSpaceClient version of this method, wildcards are not supported; however, identifiers which begin or end with this string will be returned.
            For example, if the passed identifier is "A1", then records with an identifier of "A1", "SAA1", "A10", and "SAA10" will all be returned.

        :return: A list containing every matched resource's ID.
        :rtype: list
        """
        cursor = self.db.cursor()

        if search_pattern == "" and identifier == "":
            sql = "SELECT resourceId FROM Resources ORDER BY title"
            params = ()
        else:
            clause = "resourceid LIKE %s"
            params = ["%" + search_pattern + "%"]

            if search_pattern != "":
                clause = "title LIKE %s OR" + clause
                params.insert(0, "%" + search_pattern + "%")

            if identifier != "":
                clause = "resourceIdentifier1 LIKE %s OR " + clause
                params.insert(0, "%" + identifier + "%")

            params = tuple(params)

            sql = "SELECT resourceId FROM Resources WHERE ({}) AND resourceLevel in ('recordgrp', 'collection') ORDER BY title".format(
                clause
            )

        if page is not None:
            start = (page - 1) * page_size
            sql = sql + " LIMIT {},{}".format(start, page_size)

        cursor.execute(sql, params)

        return [r[0] for r in cursor]