From 06e0c75ba9cd46cbbb09deb91db6f746fb62a820 Mon Sep 17 00:00:00 2001 From: Miran Date: Thu, 16 Apr 2020 20:22:32 +0200 Subject: make fuzzy search a bit less fuzzy (#13996) [backport:1.2] --- tools/dochack/dochack.nim | 2 +- tools/dochack/fuzzysearch.nim | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/dochack/dochack.nim b/tools/dochack/dochack.nim index 2f8465a63..4c4db4638 100644 --- a/tools/dochack/dochack.nim +++ b/tools/dochack/dochack.nim @@ -303,7 +303,7 @@ proc dosearch(value: cstring): Element = matches.add((db[i], score)) matches.sort(proc(a, b: auto): int = b[1] - a[1]) - for i in 0 ..< min(matches.len, 19): + for i in 0 ..< min(matches.len, 29): matches[i][0].innerHTML = matches[i][0].getAttribute("data-doc-search-tag") ul.add(tree("LI", cast[Element](matches[i][0]))) if ul.len == 0: diff --git a/tools/dochack/fuzzysearch.nim b/tools/dochack/fuzzysearch.nim index 05f61bc11..fecbaf4f0 100644 --- a/tools/dochack/fuzzysearch.nim +++ b/tools/dochack/fuzzysearch.nim @@ -132,6 +132,9 @@ proc fuzzyMatch*(pattern, str: cstring) : tuple[score: int, matched: bool] = strIndex += 1 + if patIndex == pattern.len and (strIndex == str.len or str[strIndex] notin Letters): + score += 10 + result = ( score: max(0, score), matched: (score > 0), -- cgit 1.4.1-2-gfad0 im/log/tests/errmsgs/twrongcolon.nim?h=devel'>log tree commit diff stats
path: root/tests/errmsgs/twrongcolon.nim
blob: e59e37660f5634a667f1d2c6ac53bb19a8c13ccc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11