mirror of
https://github.com/ashwin271/obsidian-vector-search.git
synced 2026-07-22 05:35:32 +00:00
Remove manual file tracking in favor of Obsidian API
- Remove lastUpdated and checksum from VectorData interface - Remove calculateChecksum method - Update buildVectorIndex to remove redundant tracking - Prepare for Obsidian's built-in file tracking system
This commit is contained in:
parent
b188cc388c
commit
47a952cd0d
1 changed files with 1 additions and 14 deletions
15
main.ts
15
main.ts
|
|
@ -13,8 +13,6 @@ import {
|
|||
interface VectorData {
|
||||
path: string;
|
||||
embedding: number[];
|
||||
lastUpdated: number;
|
||||
checksum: string;
|
||||
title: string;
|
||||
startLine: number;
|
||||
endLine: number;
|
||||
|
|
@ -89,15 +87,6 @@ export default class VectorSearchPlugin extends Plugin {
|
|||
);
|
||||
}
|
||||
|
||||
// Helper function to calculate checksum
|
||||
private calculateChecksum(content: string): string {
|
||||
// Simple implementation - you might want to use a proper hashing library
|
||||
return content.split('').reduce((a, b) => {
|
||||
a = ((a << 5) - a) + b.charCodeAt(0);
|
||||
return a & a;
|
||||
}, 0).toString();
|
||||
}
|
||||
|
||||
async saveSettings() {
|
||||
await this.saveData(this.settings);
|
||||
}
|
||||
|
|
@ -272,8 +261,6 @@ export default class VectorSearchPlugin extends Plugin {
|
|||
const vectorData: VectorData = {
|
||||
path: normalizePath(file.path),
|
||||
embedding: embedding,
|
||||
lastUpdated: Date.now(),
|
||||
checksum: this.calculateChecksum(chunk),
|
||||
title: `${file.basename} (chunk ${i + 1}/${chunks.length})`,
|
||||
startLine,
|
||||
endLine
|
||||
|
|
@ -288,7 +275,7 @@ export default class VectorSearchPlugin extends Plugin {
|
|||
`Indexing files: ${processed}/${total} (${Math.round((processed / total) * 100)}%)`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
this.settings.vectors = Array.from(this.vectorStore.values());
|
||||
await this.saveSettings();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue