Indexer
Task Genius uses an indexer to efficiently find and manage your tasks within Obsidian. It runs in the background to parse your Markdown files and keep task information up-to-date.
How it works
When you enable the Task Genius View, the TaskManager
initializes. To improve performance, especially in large vaults, it utilizes a pool of background Web Workers managed by the TaskWorkerManager
.
Here's a simplified flow:
- File Monitoring: The
TaskManager
watches your vault for changes (file creation, modification, deletion, renaming). - Cache Check: When a file change occurs or during initial startup, the system checks a persistent cache (
LocalStorageCache
) to see if up-to-date task data for that file already exists. Preloading from this cache significantly speeds up startup. - Task Parsing:
- If the cache is missing or outdated, the file needs processing.
- The
TaskManager
sends the file content to theTaskWorkerManager
. - The
TaskWorkerManager
assigns the parsing job to an available Web Worker. Tasks might be prioritized (e.g., user-initiated actions higher than background scans). - The Worker parses the file content using regular expressions to identify tasks and extract metadata (like dates, tags, priority) based on your chosen format (
Tasks
orDataview
). - If Web Workers fail or are disabled, parsing falls back to the main thread.
- Index & Cache Update: The parsed tasks are sent back to the
TaskManager
, which updates its internal index and stores the results in theLocalStorageCache
for future use. - View Update: An event (
task-genius:task-cache-updated
) is triggered, notifying the Task Genius views to refresh with the latest data.
If you find that the indexer isn't reflecting recent changes correctly, you can force it to clear its cache and re-index everything by running the command Task Genius: Force reindex all tasks
. Reloading Obsidian might also help in some cases.
How to disable it
You can disable the indexer by disabling the Task Genius View in the plugin settings. This will stop the background processing and file monitoring.
Settings
The indexer's behavior can be customized through the following settings:
Metadata Format Preference (Prefer Metadata Format
)
Choose the primary format the indexer should use when extracting metadata like dates, priority, and recurrence.
- Tasks: Select this to prioritize the Tasks plugin's emoji-based format (e.g.,
🛫 2025-01-01
,⏫
,🔁 every week
,#project/my-project
). It will still attempt to parse Dataview format as a fallback if the Tasks format isn't found for a specific metadata type. - Dataview: Select this to prioritize the Dataview plugin's inline field format (e.g.,
[due:: 2025-01-01]
,[priority:: high]
,[repeat:: every week]
,[project:: my-project]
). It will fall back to the Tasks emoji format if the Dataview format isn't found.
Daily Notes Integration
These settings allow you to automatically assign a date to tasks found within your daily notes, based on the note's file path.
- Use Daily Note Path as Date (
Use Daily Note Path as Date
): Enable this to extract a date from the file path of notes located within your configured daily note directory. - Daily Note Path (
Daily Note Path
): Specify the folder where your daily notes are stored (e.g.,dailies
,journal/daily
). The indexer uses this to identify which files should have dates extracted from their paths. - Daily Note Date Format (
Daily Note Date Format
): Define the date format used in your daily note file names (e.g.,yyyy-MM-dd
,yyyy/MM/dd
,dd-MM-yyyy
). This should match the structure within thedailyNotePath
. Uses date-fns format tokens. - Assign Daily Note Date As (
Assign Daily Note Date As
): Choose which date field (due
,start
, orscheduled
) the extracted daily note date should be assigned to if the task doesn't already have that specific date field set.
Focus Or Ignore Tasks Based On Heading
You can focus on specific tasks or ignore tasks based on their headings in your notes.
- Ignore all tasks behind heading (
Ignore all tasks behind heading
): Specify headings to ignore tasks under. Tasks that appear below these headings will be excluded from the task index. Enter headings in the format## Project
,## Inbox
, etc., separated by commas. - Focus all tasks behind heading (
Focus all tasks behind heading
): Specify headings to focus on tasks under. When this is set, only tasks that appear below these headings will be included in the task index. Enter headings in the format## Project
,## Inbox
, etc., separated by commas.