Skip to content

Commit e2948e5

Browse files
committed
style: cargo fmt
1 parent 7991a2d commit e2948e5

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

src/indexer.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,11 @@ pub fn run_index(vault_path: &Path, config: &Config, rebuild: bool) -> Result<In
282282
let mut next_vector_id: u64 = {
283283
// Get the max existing vector_id to avoid collisions.
284284
let all_existing = store.get_all_vectors().unwrap_or_default();
285-
all_existing.iter().map(|(id, _)| *id).max().map_or(0, |m| m + 1)
285+
all_existing
286+
.iter()
287+
.map(|(id, _)| *id)
288+
.max()
289+
.map_or(0, |m| m + 1)
286290
};
287291

288292
for result in &results {
@@ -293,7 +297,12 @@ pub fn run_index(vault_path: &Path, config: &Config, rebuild: bool) -> Result<In
293297
let vector_id = next_vector_id;
294298
next_vector_id += 1;
295299
store.insert_chunk_with_vector(
296-
file_id, heading, snippet, vector_id, *token_count as i64, vector,
300+
file_id,
301+
heading,
302+
snippet,
303+
vector_id,
304+
*token_count as i64,
305+
vector,
297306
)?;
298307
}
299308
}

src/store.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,24 @@ impl Store {
215215
self.conn.execute(
216216
"INSERT INTO chunks (file_id, heading, snippet, vector_id, token_count, vector)
217217
VALUES (?1, ?2, ?3, ?4, ?5, ?6)",
218-
params![file_id, heading, snippet, vector_id as i64, token_count, vector_bytes],
218+
params![
219+
file_id,
220+
heading,
221+
snippet,
222+
vector_id as i64,
223+
token_count,
224+
vector_bytes
225+
],
219226
)?;
220227
Ok(())
221228
}
222229

223230
/// Get all stored vectors with their IDs for HNSW index rebuild.
224231
/// Returns (vector_id, vector) pairs.
225232
pub fn get_all_vectors(&self) -> Result<Vec<(u64, Vec<f32>)>> {
226-
let mut stmt = self.conn.prepare(
227-
"SELECT vector_id, vector FROM chunks WHERE vector IS NOT NULL"
228-
)?;
233+
let mut stmt = self
234+
.conn
235+
.prepare("SELECT vector_id, vector FROM chunks WHERE vector IS NOT NULL")?;
229236
let rows = stmt.query_map([], |row| {
230237
let vid: i64 = row.get(0)?;
231238
let blob: Vec<u8> = row.get(1)?;

tests/integration.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,14 @@ fn index_vault(vault_path: &Path, data_dir: &Path, config: &Config, rebuild: boo
109109
let vector_id = next_vid;
110110
next_vid += 1;
111111
store
112-
.insert_chunk_with_vector(file_id, &heading, &chunk.snippet, vector_id, token_count, &vec)
112+
.insert_chunk_with_vector(
113+
file_id,
114+
&heading,
115+
&chunk.snippet,
116+
vector_id,
117+
token_count,
118+
&vec,
119+
)
113120
.unwrap();
114121
}
115122
}

0 commit comments

Comments
 (0)