How can I remove a spam page from my website index?

This is exactly the issue - instead of 404-ing as expected, the page is rendered as 200 with whatever the value of “q” is as the collection object’s title so it’s outputted to the page, and that’s the exploit the spammers are taking advantage of.