Skip to content

Commit

Permalink
Suggestions always exclude any matches related to active file (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadynz authored Feb 27, 2022
1 parent ff6a882 commit 38fe95a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "obsidian-sidekick",
"name": "Sidekick",
"description": "A companion to identify hidden connections that match your tags and pages",
"version": "1.5.0",
"version": "1.5.1",
"minAppVersion": "0.13.8",
"author": "Hady Osman",
"authorUrl": "https://hady.geek.nz",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-sidekick",
"version": "1.5.0",
"version": "1.5.1",
"description": "A companion to identify hidden connections that match your tags and pages",
"main": "src/index.ts",
"repository": {
Expand Down
12 changes: 7 additions & 5 deletions src/indexing/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,20 @@ export class Indexer extends TypedEmitter<IndexerEvents> {
}

public getKeywords(): string[] {
// Exclude any keywords associated with active file as we don't want recursive highlighting
const exclusionFile = this.pluginHelper.activeFile;

const keywords = this.documents
.where((doc) => doc.fileCreationTime !== exclusionFile.stat.ctime)
.find({
fileCreationTime: { $ne: this.pluginHelper.activeFile.stat.ctime }, // Always exclude indices related to active file
})
.map((doc) => doc.keyword);

return _.uniq(keywords);
}

public getDocumentsByKeyword(keyword: string): Document[] {
return this.documents.find({ keyword: keyword });
return this.documents.find({
keyword,
fileCreationTime: { $ne: this.pluginHelper.activeFile.stat.ctime }, // Always exclude indices related to active file
});
}

public buildIndex(): void {
Expand Down

0 comments on commit 38fe95a

Please sign in to comment.