[Patchew-devel] [PATCH 09/16] search: Add query_test_message
Fam Zheng
famz at redhat.com
Wed Nov 21 02:08:39 UTC 2018
This method is to test if a message belongs to a search result.
Signed-off-by: Fam Zheng <famz at redhat.com>
---
api/search.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/api/search.py b/api/search.py
index 6942ef0..0be435f 100644
--- a/api/search.py
+++ b/api/search.py
@@ -341,3 +341,9 @@ Search text keyword in the email message. Example:
if queryset is None:
queryset = Message.objects.series_heads()
return queryset.filter(q)
+
+ def query_test_message(self, query, message):
+ queryset = Message.objects.filter(id=message.id)
+ terms = [x.strip() for x in query.split() if x.strip()]
+ return self.search_series(*terms, queryset=queryset).first()
+
--
2.17.2
More information about the Patchew-devel
mailing list