Error thrown when attempting to query index on empty collection

If you're querying against an index, loki throws an error on an empty collection. I can propose a fix if this is accepted.