Mr. Lehenbauer is of course the master of all things Firebase, so listen to him. ;) However, this particular topic is one I've been laboring over for a couple of weeks now.
Here are a few of my thoughts, to enhance the "Run a separate server" and "Client-side querying" responses:
ElasticSearch (a node.js script)
With a node.js script on the server, you can have ElasticSearch integrated and providing some solid content searches in under an hour. Here's a blog post and a lib that makes it even easier: https://www.firebase.com/blog/2014-01-02-queries-part-two.html
cacheable/common queries
These can be handled by a server/cron process which reads the table and duplicates the data. For instance, assume I want to show "unavailable/available" for a user's login name during registration, but store the user records by a different unique ID for some complex reason.
My cron/server could read all the records from the users table, then insert them into another table that is stored by email address, with a value of the user's record ID (or any other data I might want to know).
This duplicated data approach is sort a manual caching technique and is a common practice in No-SQL environs; we're trading storage space (which is presumed to be cheap and available) for speed and simplified processes.
customized queries (using a queue)
Custom queries could be sent via XHR (ajax) directly to a server, which could do the hard labor and return better results. Alternately, you could utilize Firebase to connect with a server back-end by utilizing a queue.
The client places the query request as a JSON into a special Firebase table called queue
and awaits a response.
The server listens for queue.on('child_added', ...)
and serves the data back using `queue_record.child('response', ...data here...)
This has some nice advantages. For one, any number of servers could listen and serve responses, making load balancing a breeze. The code for this is very simplistic to set up and covered in another thread here in SO.
Hope this is helpful!