mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
- 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
18 lines
346 B
TypeScript
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[];
|
|
}
|