recker 1.0.16 → 1.0.17
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-panel.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/search-panel.ts"],"names":[],"mappings":"AAyCA,UAAU,kBAAkB;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAeD,qBAAa,WAAW;IACtB,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,cAAc,CAAgB;gBAE1B,OAAO,GAAE,kBAAuB;IAa5C,OAAO,CAAC,YAAY;IAed,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAiD3B,KAAK,IAAI,IAAI;IAsBb,OAAO,CAAC,gBAAgB;YAYV,cAAc;IA8C5B,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,aAAa;YAKP,aAAa;IAgC3B,OAAO,CAAC,WAAW;IAyBnB,OAAO,CAAC,cAAc;IAyCtB,OAAO,CAAC,QAAQ;IAuBhB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"search-panel.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/search-panel.ts"],"names":[],"mappings":"AAyCA,UAAU,kBAAkB;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAeD,qBAAa,WAA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BtB,aAAa,IAAI,OAAO;IAOxB,QAAQ,IAAI;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;IAYD,OAAO,CAAC,GAAG;CAKZ;AAKD,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,YAAY,CAE5E"}
|
|
@@ -12,7 +12,7 @@ export class HybridSearch {
|
|
|
12
12
|
config;
|
|
13
13
|
constructor(config = {}) {
|
|
14
14
|
this.config = {
|
|
15
|
-
fuzzyThreshold: config.fuzzyThreshold ?? 0.
|
|
15
|
+
fuzzyThreshold: config.fuzzyThreshold ?? 0.3,
|
|
16
16
|
fuzzyWeight: config.fuzzyWeight ?? 0.5,
|
|
17
17
|
semanticWeight: config.semanticWeight ?? 0.5,
|
|
18
18
|
debug: config.debug ?? false,
|
|
@@ -22,11 +22,11 @@ export class HybridSearch {
|
|
|
22
22
|
this.docs = docs;
|
|
23
23
|
this.fuse = new Fuse(docs, {
|
|
24
24
|
keys: [
|
|
25
|
-
{ name: 'keywords', weight:
|
|
26
|
-
{ name: 'title', weight:
|
|
27
|
-
{ name: 'section', weight:
|
|
28
|
-
{ name: 'path', weight:
|
|
29
|
-
{ name: 'content', weight: 0.
|
|
25
|
+
{ name: 'keywords', weight: 10 },
|
|
26
|
+
{ name: 'title', weight: 6 },
|
|
27
|
+
{ name: 'section', weight: 4 },
|
|
28
|
+
{ name: 'path', weight: 2 },
|
|
29
|
+
{ name: 'content', weight: 0.5 },
|
|
30
30
|
],
|
|
31
31
|
includeScore: true,
|
|
32
32
|
threshold: this.config.fuzzyThreshold,
|
|
@@ -111,13 +111,44 @@ export class HybridSearch {
|
|
|
111
111
|
if (category) {
|
|
112
112
|
results = results.filter((r) => r.item.category.toLowerCase().includes(category.toLowerCase()));
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
const queryTerms = this.tokenize(query);
|
|
115
|
+
const scored = results.slice(0, limit).map((r) => {
|
|
116
|
+
const fuseScore = r.score || 0;
|
|
117
|
+
const baseScore = 1 - fuseScore;
|
|
118
|
+
let boost = 0;
|
|
119
|
+
if (fuseScore < 0.3) {
|
|
120
|
+
const keywords = r.item.keywords || [];
|
|
121
|
+
const titleLower = r.item.title.toLowerCase();
|
|
122
|
+
for (const term of queryTerms) {
|
|
123
|
+
if (keywords.some(k => k.toLowerCase() === term)) {
|
|
124
|
+
boost += 0.15;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
for (const term of queryTerms) {
|
|
128
|
+
if (titleLower.includes(term)) {
|
|
129
|
+
boost += 0.10;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
boost = -0.3;
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
item: r.item,
|
|
138
|
+
baseScore,
|
|
139
|
+
boost,
|
|
140
|
+
finalScore: baseScore + boost,
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
scored.sort((a, b) => b.finalScore - a.finalScore);
|
|
144
|
+
const maxScore = scored[0]?.finalScore || 1;
|
|
145
|
+
return scored.map((r) => ({
|
|
115
146
|
id: r.item.id,
|
|
116
147
|
path: r.item.path,
|
|
117
148
|
title: r.item.title,
|
|
118
149
|
content: r.item.content,
|
|
119
150
|
snippet: this.extractSnippet(r.item.content, query),
|
|
120
|
-
score: 1
|
|
151
|
+
score: Math.max(0, Math.min(1, r.finalScore / maxScore)),
|
|
121
152
|
source: 'fuzzy',
|
|
122
153
|
}));
|
|
123
154
|
}
|
|
@@ -262,14 +293,14 @@ export class HybridSearch {
|
|
|
262
293
|
'sim', 'nao', 'ja', 'ainda', 'sempre', 'nunca', 'tambem', 'so', 'apenas',
|
|
263
294
|
'muito', 'pouco', 'mais', 'menos', 'bem', 'mal', 'assim', 'entao', 'logo',
|
|
264
295
|
'yo', 'hey', 'oi', 'ola', 'bom', 'boa', 'obrigado', 'por favor',
|
|
265
|
-
'configure', 'configuro', 'configurar', 'configurando',
|
|
266
|
-
'use', 'usar', 'using', '
|
|
267
|
-
'create', 'criar', 'creating', 'criando',
|
|
268
|
-
'setup', 'setar', 'setting', 'setando',
|
|
269
|
-
'add', 'adicionar', 'adding', 'adicionando',
|
|
270
|
-
'get', 'getting', 'pegar', 'pegando',
|
|
271
|
-
'set', 'setting', 'definir', 'definindo',
|
|
272
|
-
'make', 'making', 'fazer', 'fazendo',
|
|
296
|
+
'configure', 'configuro', 'configurar', 'configurando', 'configura',
|
|
297
|
+
'use', 'usar', 'using', 'uso', 'usa',
|
|
298
|
+
'create', 'criar', 'creating', 'criando', 'cria', 'crio',
|
|
299
|
+
'setup', 'setar', 'setting', 'setando', 'seta', 'seto',
|
|
300
|
+
'add', 'adicionar', 'adding', 'adicionando', 'adiciona', 'adiciono',
|
|
301
|
+
'get', 'getting', 'pegar', 'pegando', 'pega', 'pego',
|
|
302
|
+
'set', 'setting', 'definir', 'definindo', 'define', 'defino',
|
|
303
|
+
'make', 'making', 'fazer', 'fazendo', 'faz', 'faço', 'faco',
|
|
273
304
|
]);
|
|
274
305
|
cleanQuery(query) {
|
|
275
306
|
const words = query
|