emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/flx b9399afd48 136/182: Simplify math operations in score


From: ELPA Syncer
Subject: [nongnu] elpa/flx b9399afd48 136/182: Simplify math operations in score calculation
Date: Tue, 13 Dec 2022 03:59:37 -0500 (EST)

branch: elpa/flx
commit b9399afd487222c04f327d77caf46fbe81cbb080
Author: PythonNut <PythonNut@users.noreply.github.com>
Commit: PythonNut <PythonNut@users.noreply.github.com>

    Simplify math operations in score calculation
---
 flx.el | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/flx.el b/flx.el
index 77f3d3477b..b51d5104c1 100644
--- a/flx.el
+++ b/flx.el
@@ -272,14 +272,15 @@ See documentation for logic."
             (dolist (index indexes (and match (list match)))
               (dolist (elem (flx-get-matches-worker index (1+ q-index)
                                                     query-length heatmap 
match-cache str-info query))
-                (setq score (+ (cadr elem)
-                               (aref heatmap index)
-                               (if (= (1- (caar elem)) index)
-                                   (+ (* (min (cddr elem)
-                                              3)
-                                         15)
-                                      60)
-                                 0)))
+                (setq score (if (= (1- (caar elem)) index)
+                                (+ (cadr elem)
+                                   (aref heatmap index)
+                                   (* (min (cddr elem)
+                                           3)
+                                      15)
+                                   60)
+                              (+ (cadr elem)
+                                 (aref heatmap index))))
 
                 ;; we only care about the optimal score
                 (when (> score best-score)
@@ -308,12 +309,11 @@ See documentation for logic."
                                       query-length heatmap match-cache 
str-info query)))
       ;; postprocess candidate
       (and res
-         (cons (+ (cl-cadar res)
-                  (if (and full-match-boost
-                         (=  (length (caar res))
-                             (length str)))
-                      10000
-                    0))
+           (cons (if (and full-match-boost
+                          (=  (length (caar res))
+                              (length str)))
+                     (+ (cl-cadar res) 10000)
+                   (cl-cadar res))
                (caar res))))))
 
 (defun flx-propertize (obj score &optional add-score)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]