Skip to content

Commit 4e15d92

Browse files
mweinbachclaude
andcommitted
fix(server): match fff-node score struct to the native layout
FffScore has a path_alignment_bonus i32 before exact_match that the JS struct omitted, so exact_match was read from the wrong byte. match_type already sat at offset 40 in both layouts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 2738699 commit 4e15d92

2 files changed

Lines changed: 16 additions & 15 deletions

File tree

‎patches/@[email protected]‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
diff --git a/package.json b/package.json
2-
index e000a78..8432546 100644
32
--- a/package.json
43
+++ b/package.json
54
@@ -11,7 +11,7 @@
@@ -70,16 +69,18 @@ diff --git a/dist/index.js b/dist/index.js
7069
size: DataType.U64,
7170
modified: DataType.U64,
7271
access_frecency_score: DataType.I64,
73-
@@ -446,7 +457,7 @@ var FFF_SCORE_STRUCT = {
72+
@@ -445,8 +456,9 @@ var FFF_SCORE_STRUCT = {
73+
distance_penalty: DataType.I32,
7474
current_file_penalty: DataType.I32,
7575
combo_match_boost: DataType.I32,
76+
+ path_alignment_bonus: DataType.I32,
7677
exact_match: DataType.U8,
7778
- match_type: DataType.External
7879
+ match_type: DataType.String
7980
};
8081
var FFF_SEARCH_RESULT_STRUCT = {
8182
items: DataType.External,
82-
@@ -462,8 +473,8 @@ var FFF_SEARCH_RESULT_STRUCT = {
83+
@@ -462,8 +474,8 @@ var FFF_SEARCH_RESULT_STRUCT = {
8384
location_end_col: DataType.I32
8485
};
8586
var FFF_DIR_ITEM_STRUCT = {
@@ -90,7 +91,7 @@ diff --git a/dist/index.js b/dist/index.js
9091
max_access_frecency: DataType.I32
9192
};
9293
var FFF_DIR_SEARCH_RESULT_STRUCT = {
93-
@@ -475,9 +486,9 @@ var FFF_DIR_SEARCH_RESULT_STRUCT = {
94+
@@ -475,9 +487,9 @@ var FFF_DIR_SEARCH_RESULT_STRUCT = {
9495
};
9596
var FFF_MIXED_ITEM_STRUCT = {
9697
item_type: DataType.U8,
@@ -103,7 +104,7 @@ diff --git a/dist/index.js b/dist/index.js
103104
size: DataType.U64,
104105
modified: DataType.U64,
105106
access_frecency_score: DataType.I64,
106-
@@ -500,10 +511,10 @@ var FFF_MIXED_SEARCH_RESULT_STRUCT = {
107+
@@ -500,10 +512,10 @@ var FFF_MIXED_SEARCH_RESULT_STRUCT = {
107108
location_end_col: DataType.I32
108109
};
109110
var FFF_GREP_MATCH_STRUCT = {
@@ -118,7 +119,7 @@ diff --git a/dist/index.js b/dist/index.js
118119
match_ranges: DataType.External,
119120
context_before: DataType.External,
120121
context_after: DataType.External,
121-
@@ -598,18 +609,13 @@ function readMixedItemFromRaw(raw) {
122+
@@ -598,18 +610,13 @@ function readMixedItemFromRaw(raw) {
122123
}
123124
function callAccessor(funcName, resultPtr, index, structDef) {
124125
loadLibrary();
@@ -139,15 +140,15 @@ diff --git a/dist/index.js b/dist/index.js
139140
}
140141
function ptrOffset(base, bytes) {
141142
return load({
142-
@@ -766,6 +772,7 @@ function parseSearchResult(rawPtr) {
143+
@@ -766,6 +773,7 @@ function parseSearchResult(rawPtr) {
143144
}
144145
const items = [];
145146
const scores = [];
146147
+ const includeScores = count <= 200;
147148
for (let i = 0; i < count; i++) {
148149
const rawItem = callAccessor(
149150
"fff_search_result_get_item",
150-
@@ -774,13 +781,15 @@ function parseSearchResult(rawPtr) {
151+
@@ -774,13 +782,15 @@ function parseSearchResult(rawPtr) {
151152
FFF_FILE_ITEM_STRUCT
152153
);
153154
items.push(readFileItemFromRaw(rawItem));
@@ -170,15 +171,15 @@ diff --git a/dist/index.js b/dist/index.js
170171
}
171172
load({
172173
library: LIBRARY_KEY,
173-
@@ -824,6 +833,7 @@ function parseDirSearchResult(rawPtr) {
174+
@@ -824,6 +834,7 @@ function parseDirSearchResult(rawPtr) {
174175
const count = sr.count;
175176
const items = [];
176177
const scores = [];
177178
+ const includeScores = count <= 200;
178179
for (let i = 0; i < count; i++) {
179180
const rawItem = callAccessor(
180181
"fff_dir_search_result_get_item",
181-
@@ -832,13 +842,15 @@ function parseDirSearchResult(rawPtr) {
182+
@@ -832,13 +843,15 @@ function parseDirSearchResult(rawPtr) {
182183
FFF_DIR_ITEM_STRUCT
183184
);
184185
items.push(readDirItemFromRaw(rawItem));
@@ -201,15 +202,15 @@ diff --git a/dist/index.js b/dist/index.js
201202
}
202203
load({
203204
library: LIBRARY_KEY,
204-
@@ -897,6 +909,7 @@ function parseMixedSearchResult(rawPtr) {
205+
@@ -897,6 +910,7 @@ function parseMixedSearchResult(rawPtr) {
205206
}
206207
const items = [];
207208
const scores = [];
208209
+ const includeScores = count <= 200;
209210
for (let i = 0; i < count; i++) {
210211
const rawItem = callAccessor(
211212
"fff_mixed_search_result_get_item",
212-
@@ -905,13 +918,15 @@ function parseMixedSearchResult(rawPtr) {
213+
@@ -905,13 +919,15 @@ function parseMixedSearchResult(rawPtr) {
213214
FFF_MIXED_ITEM_STRUCT
214215
);
215216
items.push(readMixedItemFromRaw(rawItem));

‎pnpm-lock.yaml‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)