aboutsummaryrefslogtreecommitdiffhomepage
path: root/bindings
diff options
context:
space:
mode:
authorGravatar Justus Winter <4winter@informatik.uni-hamburg.de>2012-02-18 01:32:21 +0100
committerGravatar Justus Winter <4winter@informatik.uni-hamburg.de>2012-02-18 01:39:39 +0100
commitff8f864245c3ac54cc23aa47af09c95cde484abb (patch)
tree1197324990b0f57d0ee55e3f2981798b68cc2667 /bindings
parent4315ac015a1ba329880031805f4706731b3c1ef4 (diff)
python: wrap notmuch_query_count_threads as Query.count_threads
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Diffstat (limited to 'bindings')
-rw-r--r--bindings/python/docs/source/index.rst2
-rw-r--r--bindings/python/notmuch/query.py19
2 files changed, 21 insertions, 0 deletions
diff --git a/bindings/python/docs/source/index.rst b/bindings/python/docs/source/index.rst
index f7d3d605..5405de8e 100644
--- a/bindings/python/docs/source/index.rst
+++ b/bindings/python/docs/source/index.rst
@@ -128,6 +128,8 @@ More information on specific topics can be found on the following pages:
.. automethod:: count_messages
+ .. automethod:: count_threads
+
:class:`Messages` -- A bunch of messages
----------------------------------------
diff --git a/bindings/python/notmuch/query.py b/bindings/python/notmuch/query.py
index d4a93d5b..14c00cd5 100644
--- a/bindings/python/notmuch/query.py
+++ b/bindings/python/notmuch/query.py
@@ -182,6 +182,25 @@ class Query(object):
self._assert_query_is_initialized()
return Query._count_messages(self._query)
+ _count_threads = nmlib.notmuch_query_count_threads
+ _count_threads.argtypes = [NotmuchQueryP]
+ _count_threads.restype = c_uint
+
+ def count_threads(self):
+ '''
+ This function performs a search and returns the number of
+ unique thread IDs in the matching messages. This is the same
+ as number of threads matching a search.
+
+ Note that this is a significantly heavier operation than
+ meth:`Query.count_messages`.
+
+ :returns: the number of threads returned by this query
+ :rtype: int
+ '''
+ self._assert_query_is_initialized()
+ return Query._count_threads(self._query)
+
_destroy = nmlib.notmuch_query_destroy
_destroy.argtypes = [NotmuchQueryP]
_destroy.restype = None