def METHOD_NAME(project_id, user_id, details=False):
    with pg_client.PostgresClient() as cur:
        cur.execute(
            cur.mogrify(
                f"""\
                SELECT search_id, project_id, user_id, name, created_at, deleted_at, is_public
                    {",filter" if details else ""}
                FROM public.searches
                WHERE project_id = %(project_id)s
                  AND deleted_at IS NULL
                  AND (user_id = %(user_id)s OR is_public);""",
                {"project_id": project_id, "user_id": user_id}
            )
        )
        rows = cur.fetchall()
        rows = helper.list_to_camel_case(rows)
        for row in rows:
            row["createdAt"] = TimeUTC.datetime_to_timestamp(row["createdAt"])
            if details:
                if isinstance(row["filter"], list) and len(row["filter"]) == 0:
                    row["filter"] = {}
                row["filter"] = helper.old_search_payload_to_flat(row["filter"])
    return rows