Fixed #23875 -- cleaned up query.get_count()

The query.get_count() can be significantly cleared up due to expressions API changes.