#392 added support for last_n_items query

Resolves #392