From 09aff5299d4755639192b628343a34f209b4cfad Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Sun, 21 May 2017 20:39:13 +0800 Subject: [PATCH] Do result limiting in the indexed engine process * lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output): Limit number of results, in case the engine didn't handle it. --- lisp/gnus/gnus-search.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 25933d9210a..d4b9db17309 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -1460,6 +1460,12 @@ Returns a list of [group article score] vectors." ;; Are we running an additional grep query? (when-let ((grep-reg (alist-get 'grep query))) (setq artlist (gnus-search-grep-search engine artlist grep-reg))) + ;; Some engines do result limiting on their own, some don't. Just + ;; make sure. + (when-let ((limit (alist-get 'limit query))) + (setq artlist (cl-subseq artlist 0 + (min limit (length artlist))))) + ;; Turn (file-name score) into [group article score]. (pcase-dolist (`(,f-name ,score) artlist) (setq article (file-name-nondirectory f-name)) ;; Remove prefix. -- 2.39.5