[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx 8ee8a877ab 028/182: boost entire match score
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx 8ee8a877ab 028/182: boost entire match score |
Date: |
Tue, 13 Dec 2022 03:59:22 -0500 (EST) |
branch: elpa/flx
commit 8ee8a877abca48de3f9f3dcd0d8d816fc740971d
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
boost entire match score
- This is helpful when the matched string is short.
resolves #7
---
flx.el | 13 ++++++++-----
tests/flx-test.el | 9 ++++++++-
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/flx.el b/flx.el
index 7d429c1d37..102b5db2cb 100644
--- a/flx.el
+++ b/flx.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 4
+;; Update #: 6
;; URL:
;; Keywords:
;; Compatibility:
@@ -286,11 +286,14 @@ e.g. (\"aab\" \"ab\") returns
(heatmap (gethash 'heatmap info-hash))
(matches (flx-get-matches info-hash query))
(best-score nil))
- (mapc (lambda (match-vector)
- (let ((score 0)
+ (mapc (lambda (match-positions)
+ (let ((score (if (= (length match-positions)
+ (length str))
+ 10000
+ 0))
(contiguous-count 0)
last-match)
- (loop for index in match-vector
+ (loop for index in match-positions
do (progn
(if (and last-match
(= (1+ last-match) index))
@@ -302,7 +305,7 @@ e.g. (\"aab\" \"ab\") returns
(setq last-match index)))
(if (or (null best-score)
(> score (car best-score)))
- (setq best-score (cons score match-vector)))))
+ (setq best-score (cons score match-positions)))))
matches)
best-score)))
diff --git a/tests/flx-test.el b/tests/flx-test.el
index 73b30b6fb1..e4035bd51e 100644
--- a/tests/flx-test.el
+++ b/tests/flx-test.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 4
+;; Update #: 5
;; URL:
;; Keywords:
;; Compatibility:
@@ -191,6 +191,13 @@
(should (> (car higher) (car lower)))))
+(ert-deftest flx-entire-match ()
+ "when entire string is match, it shoud overpower acronym matches"
+ (let* ((query "rss")
+ (higher (flx-score "rss" query (flx-make-filename-cache)))
+ (lower (flx-score "rff-sff-sff" query (flx-make-filename-cache))))
+ (should (> (car higher) (car lower)))))
+
;;;;;;;;;;;;;;
;; advanced ;;
;;;;;;;;;;;;;;
- [nongnu] elpa/flx 24dd436463 100/182: Fix compilation errors., (continued)
- [nongnu] elpa/flx 24dd436463 100/182: Fix compilation errors., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx b322b72d7b 131/182: async comes from melpa, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 551b095274 130/182: fix travis cask path, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 26a1225431 137/182: rename optimization test, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 7a2601481c 142/182: Simplify flx-propertize, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx b95294518c 155/182: Debian and Ubuntu installation instructions, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 46040d0b09 160/182: Merge pull request #97 from antmak/patch-1, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 05600ff855 167/182: Merge pull request #103 from phst/add-license-file, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx e3b3f0533e 174/182: Merge pull request #108 from tarsiiformes/cleanup, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 48e10bf54f 177/182: Update to latest version of GPLv3 boilerplate, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 8ee8a877ab 028/182: boost entire match score,
ELPA Syncer <=
- [nongnu] elpa/flx 78dc69a666 023/182: fix query with CAPITAL letters, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 095f2e70f9 040/182: remove text property of selected item, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 50ff90fa08 017/182: add ido cache of narrowed list optimization, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3208d8131e 043/182: make undecorate select item more thorough, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx fb1ded43df 044/182: cache cons cell lists too, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx d21ac098df 050/182: add option `flx-ido-use-faces', ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f9bd16221b 063/182: update large collection guidelines, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 27bc47899a 075/182: Merge pull request #37 from artagnon/make, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx abe1a77c02 081/182: Merge pull request #38 from artagnon/cl-lib, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 9200e27309 083/182: use "flex" filtering when collection too large, ELPA Syncer, 2022/12/13