@hevmind/ask 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/src/search/prefilter.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hevmind/ask",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "hev ask: a heading-anchored, agentic search overlay for Astro docs sites.",
|
|
6
6
|
"keywords": [
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"ask": "./bin/ask.mjs"
|
|
29
29
|
},
|
|
30
30
|
"optionalDependencies": {
|
|
31
|
-
"@hevmind/ask-darwin-
|
|
32
|
-
"@hevmind/ask-
|
|
33
|
-
"@hevmind/ask-linux-
|
|
34
|
-
"@hevmind/ask-
|
|
35
|
-
"@hevmind/ask-
|
|
31
|
+
"@hevmind/ask-darwin-x64": "0.3.3",
|
|
32
|
+
"@hevmind/ask-darwin-arm64": "0.3.3",
|
|
33
|
+
"@hevmind/ask-linux-x64": "0.3.3",
|
|
34
|
+
"@hevmind/ask-win32-x64": "0.3.3",
|
|
35
|
+
"@hevmind/ask-linux-arm64": "0.3.3"
|
|
36
36
|
},
|
|
37
37
|
"exports": {
|
|
38
38
|
".": "./src/index.ts",
|
package/src/search/prefilter.ts
CHANGED
|
@@ -81,11 +81,16 @@ export function prefilter(
|
|
|
81
81
|
const scored = chunks
|
|
82
82
|
.map((chunk) => {
|
|
83
83
|
const boost = signal.get(chunk.id);
|
|
84
|
+
// A query term in the section heading or page title is a strong topical
|
|
85
|
+
// signal — the page titled "OIDC Authentication" is what someone asking
|
|
86
|
+
// about "oidc" wants, far more than a page that merely mentions it.
|
|
87
|
+
const headingTokens = new Set([...tokenize(chunk.heading ?? ''), ...tokenize(chunk.docTitle ?? '')]);
|
|
84
88
|
let raw = 0;
|
|
85
89
|
for (const term of terms) {
|
|
86
90
|
const weight = weights.get(term) ?? 0;
|
|
87
91
|
if (chunk.tokens.has(term)) raw += weight;
|
|
88
92
|
if (boost?.has(term)) raw += weight;
|
|
93
|
+
if (headingTokens.has(term)) raw += weight * 3;
|
|
89
94
|
}
|
|
90
95
|
// Length-penalize (not -reward): a huge page (e.g. an autogenerated CLI flag
|
|
91
96
|
// dump that mentions nearly every term) is divided down, but short sections
|