diff options
Diffstat (limited to 'tools/dochack')
-rw-r--r-- | tools/dochack/dochack.nim | 2 | ||||
-rw-r--r-- | tools/dochack/fuzzysearch.nim | 3 |
2 files changed, 4 insertions, 1 deletions
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), |