Disallow: /?q=search/ in robot.txt
First of all it's robots.txt. Next, supplying something in there doesn't magically means that you "can't web scrape the search". It's just a directive for the robots to follow. But it won't stop them to fetching those URLs if they want to (i.e. some malicious web fetchers & scripts might just ignore your robots.txt or even use information from it to fetch info you wanted to protect).
And answering your question, you can't specify an anchor with robots.txt. This has been answered here: https://stackoverflow.com/questions/53676849/robots-txt-handling-a-in-a-url
Besides specifying a directive Disallow in robots.txt doesn't includes location. It's just a substring match anywhere in the URL.