andy-stack_vaultkeeper-ai/Helpers/SearchTypes.ts
Andrew Beal d58e9ef1ff refactor: enhance vault search to return content snippets with context
- Update SearchVaultFiles function to return contextual snippets instead of just file lists
- Implement snippet extraction with configurable context length (300 chars)
- Add snippet merging logic to consolidate overlapping matches
- Limit results to 20 randomly sampled matches when exceeding threshold
- Update return types across service layer to use SearchMatch/SearchSnippet
- Change regex flags to 'ig' for global case-insensitive matching
2025-10-14 19:50:45 +01:00

18 lines
346 B
TypeScript

import { TFile } from "obsidian";
/**
* Represents a single snippet of matched content from a file
*/
export interface SearchSnippet {
text: string;
matchIndex: number;
matchLength: number;
}
/**
* Represents all matches found in a single file
*/
export interface SearchMatch {
file: TFile;
snippets: SearchSnippet[];
}