I should probably have an assert on the integerness of episode_key when trying to search in an episode range or order by the episode key rather than the search score.
Right now, my understanding is that CAST('episode400' as int) will return 0 so the sorting just won't do anything. It does order by episode_key, score so if the episode_key searching does nothing you'll just get it by score, but it doesn't say anywhere that 'whoops casting the episode key to integer isn't working.'