[Patchew-devel] [PATCH 09/16] search: Add query_test_message

Paolo Bonzini pbonzini at redhat.com
Fri Nov 23 15:03:30 UTC 2018


On 21/11/18 03:08, Fam Zheng wrote:
> 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()
> +
> 

You can squash this with the patch that uses it.

Paolo




More information about the Patchew-devel mailing list