Implement IN and BETWEEN for link queries

Added some more tests for link queries and it turned out that I missed that link queries need an entirely separate implementation of them from normal queries.
I was able to measure a 1-2% speedup in some cases on ARM as it gets called a lot and ARM branch prediction isn't very good.