summaryrefslogtreecommitdiff
path: root/alot/db
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-02-10 10:52:50 +0100
committerAnton Khirnov <anton@khirnov.net>2021-02-10 10:53:13 +0100
commit752860cf24fc22208d7e9138d0a13ea5d616b4ca (patch)
treec2c5bee955bcfccb9a660892a58c89e1f5fe886b /alot/db
parent90e4d88cd4883dd015a511d7f8e1e7e09e062ac4 (diff)
widgets/search: display the number of matching messages in the thread
Diffstat (limited to 'alot/db')
-rw-r--r--alot/db/thread.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/alot/db/thread.py b/alot/db/thread.py
index 13ddabda..b6634b57 100644
--- a/alot/db/thread.py
+++ b/alot/db/thread.py
@@ -214,3 +214,14 @@ class Thread:
thread_query = 'thread:%s AND (%s)' % (self.id, query)
num_matches = self._dbman.count_messages(thread_query)
return num_matches > 0
+
+ def count_matches(self, query):
+ """
+ Count the number of messags in this thread that match the given notmuch
+ query.
+
+ :param query: The query to check against
+ :type query: string
+ """
+ thread_query = 'thread:%s AND (%s)' % (self.id, query)
+ return self._dbman.count_messages(thread_query)