I would indeed prioritize tvmaze over rageid, as that seems to be more future-proof.
As for the importance and priority if q I’m not sure.
Reason is, I’m not to sure what Sonarr utlizes for show name resolution, and what they put in the q query.
So from Sonarr perspective, it might be a unneeded webquery to tvmaze to resolve the showname, as it might be identical to what Sonarr puts in the q parameter (which doesn’t need additional webcalls to resolve the name).
From a broader perspective, resolving it indexer side on an id will always give the same result, not depending on what the client happens to put in the q parameter.
As Spotweb acts as a generic indexer, I would prioritize similarity in result over additional web calls, and thereby place q last.
Maybe @Taloth can pitch in his thoughts, as he has the most experiance on how the “web” indexers handle things.