]> git.eshelyaron.com Git - emacs.git/commitdiff
Do result limiting in the indexed engine process
authorEric Abrahamsen <eric@ericabrahamsen.net>
Sun, 21 May 2017 12:39:13 +0000 (20:39 +0800)
committerEric Abrahamsen <eric@ericabrahamsen.net>
Fri, 26 May 2017 05:47:43 +0000 (13:47 +0800)
* 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

index 25933d9210ab60d99118fc58d58cc028cf3a8968..d4b9db17309393bf39d63bfe3b080476d0a755a3 100644 (file)
@@ -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.