Skip to content

Commit c8493c8

Browse files
committed
Mothball the tagCache for now
1 parent 3d2f960 commit c8493c8

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

helpers/NPnote.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,15 +616,15 @@ export function getNoteTitleFromFilename(filename: string, makeLink?: boolean =
616616
617617
/**
618618
* Return list of notes with a given #hashtag or @mention (singular), with further optional parameters about which (sub)folders to look in, and a term to defeat on etc.
619-
* Note: since Feb 2025 there is newer mechanism for this: the tagMentionCache, which is much more efficient.
619+
* Note: in Feb 2025 there @jgclark developed almost all of a newer mechanism for this: the tagMentionCache. But then this suddenly seemed to speed up, after a little refactoring. Mystifying.
620620
* @author @jgclark
621621
* @param {string} item - tag/mention name to look for
622622
* @param {boolean} caseInsensitiveMatch? - whether to ignore case when matching
623623
* @param {boolean} alsoSearchCalendarNotes? - whether to search calendar notes
624624
* @param {boolean} excludeSpecialFolders? - whether to ignore regular notes in special folders, i.e. those starting with '@', including @Templates, @Archive and @Trash (optional, defaults to true)
625625
* @param {Array<string>} itemsToExclude - optional list of tags/mentions that if found in the note, excludes the note
626626
* @param {string?} folder - optional folder to limit to
627-
* @param {boolean} includeSubfolders? - if folder given, whether to look in subfolders of this folder or not
627+
* @param {boolean?} includeSubfolders? - if folder given, whether to look in subfolders of this folder or not (optional, defaults to false)
628628
* @return {Array<TNote>}
629629
*/
630630
export function findNotesMatchingHashtagOrMention(
@@ -634,7 +634,7 @@ export function findNotesMatchingHashtagOrMention(
634634
excludeSpecialFolders: boolean,
635635
itemsToExclude: Array<string> = [],
636636
folder: ?string,
637-
includeSubfolders: boolean,
637+
includeSubfolders?: boolean = false,
638638
): Array<TNote> {
639639
try {
640640
// Check for special conditions first
@@ -718,7 +718,6 @@ export function findNotesMatchingHashtagOrMention(
718718

719719
/**
720720
* From a given array of notes, return the subset with a given #hashtag or @mention (singular), with further optional parameters about which (sub)folders to look in, and a term to defeat on etc.
721-
* Note: since Feb 2025 there is newer mechanism for this: the tagMentionCache, which is much more efficient.
722721
* @author @jgclark
723722
* @param {string} item - tag/mention name to look for
724723
* @param {Array<TNote>} notesToSearchIn - array of notes to search in

jgclark.Dashboard/src/tagMentionCache.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
// @flow
22
//-----------------------------------------------------------------------------
33
// Cache helper functions for Dashboard
4-
// last updated for v2.2.0, 2025-02-09 by @jgclark
4+
// last updated for v2.1.10, 2025-02-14 by @jgclark
55
//-----------------------------------------------------------------------------
66

7+
/**
8+
* WARNING: In a weird development (literally), I found that a refactor of the original findNotesWithMatchingHashtag() suddenly made it now as fast, if not faster, as this new Cache.
9+
* I didn't take out any code, so I'm mystified.
10+
* But not complaining, particularly as this still had some work required.
11+
*/
12+
713
import moment from 'moment/min/moment-with-locales'
814
// import { getDateStringFromCalendarFilename, getTodaysDateHyphenated } from '@helpers/dateTime'
915
import { clo, clof, JSP, log, logDebug, logError, logInfo, logTimer, logWarn } from '@helpers/dev'

0 commit comments

Comments
 (0)