Function: nnir-compose-result

nnir-compose-result is a byte-compiled function defined in nnir.el.gz.

Signature

(nnir-compose-result DIRNAM ARTICLE SCORE PREFIX SERVER)

Documentation

Construct a result vector.

The DIRNAM, ARTICLE, SCORE, PREFIX, and SERVER are used to construct the vector entries.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/nnir.el.gz
;; Helper function currently used by the Swish++ and Namazu backends;
;; perhaps useful for other backends as well
(defun nnir-compose-result (dirnam article score prefix server)
  "Construct a result vector.
The DIRNAM, ARTICLE, SCORE, PREFIX, and SERVER are used to
construct the vector entries."
  ;; remove nnir-*-remove-prefix from beginning of dirnam filename
  (when (string-match (concat "^" prefix) dirnam)
    (setq dirnam (replace-match "" t t dirnam)))

  (when (file-readable-p (concat prefix dirnam article))
    ;; remove trailing slash and, for nnmaildir, cur/new/tmp
    (setq dirnam
	  (substring dirnam 0
		     (if (string-match "\\`nnmaildir:" (gnus-group-server server))
			 -5 -1)))

    ;; Set group to dirnam without any leading dots or slashes,
    ;; and with all subsequent slashes replaced by dots
    (let ((group (replace-regexp-in-string
		  "[/\\]" "."
		  (replace-regexp-in-string "^[./\\]" "" dirnam nil t)
		  nil t)))

    (vector (gnus-group-full-name group server)
	    (if (string-match "\\`nnmaildir:" (gnus-group-server server))
		(nnmaildir-base-name-to-article-number
		 (substring article 0 (string-search ":" article))
		 group nil)
	      (string-to-number article))
	    (string-to-number score)))))