-
-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid full vault scan on incremental indexing #1148
Conversation
1201034
to
df7bb23
Compare
Thanks for fixing this! How did you test it? |
In terms of functionality, I tested inclusion and exclusion with tags, file extension, and single file match with In terms of performance, this part gets confusing. I created a vault with 40000 files. I was hoping to see the 5-second delay as described in the issue, but I couldn't reproduce it. As you can see in my screenshot, even after I added |
df7bb23
to
ddb3a63
Compare
src/utils.ts
Outdated
* @param vault - The vault to get tags from. | ||
* @returns An array of lowercase tags without the hash symbol. | ||
*/ | ||
export function getTagsFromNote(file: TFile): string[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now returning both inline and frontmatter tags, while before it only returns frontmatter tags.
The reason I only get frontmatter tags is to
- Limit the number of notes from tags for custom prompt templating {#tag1, #tags2...} and avoiding overcrowding the context window
- Have a differentiation between frontmatter tags and inline tags. Consider frontmatter tags a "note-level" property and inline tags as "line/block-level" property.
So this change will affect not only index filtering but also custom prompt processing. Currently, inline tags are used via salient terms during vault search.
Should we put a parameter here to control what tags to return? Such as frontmatterOnly = true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
getNotesFromPath, | ||
getNotesFromTags, | ||
isFolderMatch, | ||
isPathInList, | ||
processVariableNameForNotePath, | ||
} from "../src/utils"; | ||
|
||
// Mock Obsidian's TFile class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to mock these because of the usage of app.vault.metadataCache
src/utils.ts
Outdated
* @param vault - The vault to get tags from. | ||
* @returns An array of lowercase tags without the hash symbol. | ||
*/ | ||
export function getTagsFromNote(file: TFile): string[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Previously, we added an incremental indexing feature for copilot plus users. On any note update, It generates the excluded file list and checks whether the current file should be updated. This process can take 5 seconds for large vaults and causes the plugin to be unusable in those extreme scenarios. This PR fixes the issue by stopping the generation of included/excluded file lists and matching the current file path against the matching patterns.
shouldIndexFile
method that checks whether a TFile should be indexed. It consolidates all the custom validation logic that checksinclusions
andexclusions
.