raggrep 0.2.1 → 0.2.2
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/dist/cli/main.js +10 -13
- package/dist/cli/main.js.map +4 -4
- package/dist/index.js +9 -12
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2779,19 +2779,16 @@ class TypeScriptModule {
|
|
|
2779
2779
|
const { topK = DEFAULT_TOP_K2, minScore = DEFAULT_MIN_SCORE2, filePatterns } = options;
|
|
2780
2780
|
const indexDir = getRaggrepDir(ctx.rootDir, ctx.config);
|
|
2781
2781
|
const symbolicIndex = new SymbolicIndex(indexDir, this.id);
|
|
2782
|
-
let
|
|
2782
|
+
let allFiles;
|
|
2783
2783
|
try {
|
|
2784
2784
|
await symbolicIndex.initialize();
|
|
2785
|
-
|
|
2786
|
-
candidateFiles = symbolicIndex.findCandidates(query, maxCandidates);
|
|
2787
|
-
if (candidateFiles.length === 0) {
|
|
2788
|
-
candidateFiles = symbolicIndex.getAllFiles();
|
|
2789
|
-
}
|
|
2785
|
+
allFiles = symbolicIndex.getAllFiles();
|
|
2790
2786
|
} catch {
|
|
2791
|
-
|
|
2787
|
+
allFiles = await ctx.listIndexedFiles();
|
|
2792
2788
|
}
|
|
2789
|
+
let filesToSearch = allFiles;
|
|
2793
2790
|
if (filePatterns && filePatterns.length > 0) {
|
|
2794
|
-
|
|
2791
|
+
filesToSearch = allFiles.filter((filepath) => {
|
|
2795
2792
|
return filePatterns.some((pattern) => {
|
|
2796
2793
|
if (pattern.startsWith("*.")) {
|
|
2797
2794
|
const ext = pattern.slice(1);
|
|
@@ -2804,7 +2801,7 @@ class TypeScriptModule {
|
|
|
2804
2801
|
const queryEmbedding = await getEmbedding(query);
|
|
2805
2802
|
const bm25Index = new BM25Index;
|
|
2806
2803
|
const allChunksData = [];
|
|
2807
|
-
for (const filepath of
|
|
2804
|
+
for (const filepath of filesToSearch) {
|
|
2808
2805
|
const fileIndex = await ctx.loadFileIndex(filepath);
|
|
2809
2806
|
if (!fileIndex)
|
|
2810
2807
|
continue;
|
|
@@ -2831,7 +2828,7 @@ class TypeScriptModule {
|
|
|
2831
2828
|
}
|
|
2832
2829
|
const queryTerms = query.toLowerCase().split(/\s+/).filter((t) => t.length > 2);
|
|
2833
2830
|
const pathBoosts = new Map;
|
|
2834
|
-
for (const filepath of
|
|
2831
|
+
for (const filepath of filesToSearch) {
|
|
2835
2832
|
const summary = symbolicIndex.getFileSummary(filepath);
|
|
2836
2833
|
if (summary?.pathContext) {
|
|
2837
2834
|
let boost = 0;
|
|
@@ -2896,7 +2893,7 @@ class TypeScriptModule {
|
|
|
2896
2893
|
return references;
|
|
2897
2894
|
}
|
|
2898
2895
|
}
|
|
2899
|
-
var DEFAULT_MIN_SCORE2 = 0.15, DEFAULT_TOP_K2 = 10, SEMANTIC_WEIGHT = 0.7, BM25_WEIGHT = 0.3
|
|
2896
|
+
var DEFAULT_MIN_SCORE2 = 0.15, DEFAULT_TOP_K2 = 10, SEMANTIC_WEIGHT = 0.7, BM25_WEIGHT = 0.3;
|
|
2900
2897
|
var init_typescript = __esm(() => {
|
|
2901
2898
|
init_embeddings();
|
|
2902
2899
|
init_config2();
|
|
@@ -3627,4 +3624,4 @@ export {
|
|
|
3627
3624
|
cleanup
|
|
3628
3625
|
};
|
|
3629
3626
|
|
|
3630
|
-
//# debugId=
|
|
3627
|
+
//# debugId=719044F94BD570BC64756E2164756E21
|