That is where modules CAN come into play if you are so inclined. Instead of writing out the search logic every time, you can have a search module that you just call search with your columns and filters. I haven't gone that far as it may be overengineering but you CAN.