Apologies for the confusion last night/this-morning with the count patches. I'm resending the whole series with at least one important bug fix. [Patch v4 1/9] lib: move query variable to function scope [Patch v4 2/9] cli/count: simplify and document return value of The first two patches are setup. [Patch v4 3/9] lib: add versions of n_q_count_{message,threads} with this is the meat of the series, which adds the new functions, and converts the lib to use them. I thought about cleaning up some of the de-allocation paths using talloc_steal, but I concluded that could wait [Patch v4 4/9] cli: update to use new count API [Patch v4 5/9] ruby: use new count API [Patch v4 6/9] python: update bindings for new count API this migrates the CLI and bindings to use the new API. [Patch v4 7/9] lib: migrate notmuch_database_upgrade to new [Patch v4 8/9] lib: migrate thread.cc to new query_search API [Patch v4 9/9] ruby: use new query_search API Finally, some long overdue cleanup of deprecation warnings for the previous API change. These rely on the same setup patches (namely 1/9), so I put them in the same series.