From 752860cf24fc22208d7e9138d0a13ea5d616b4ca Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 10 Feb 2021 10:52:50 +0100 Subject: widgets/search: display the number of matching messages in the thread --- alot/db/thread.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'alot/db') 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) -- cgit v1.2.3