epwalsh / epwalsh/obsidian.nvim

ObsidianSearch is extremely slow

Open
#421 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Lua
Stars
6.2k
Forks
250
PR merge metrics
No merged PRs in 30d

Description

### 🐛 Describe the bug

ObsidianSearch is extremely slow and it only shows results after 10/20 seconds.
ripgrep is installed and fully functional in other use cases. I can't figure out the problem when used with ObisianSearch

### Config

```
{
"epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
lazy = true,
ft = "markdown",
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
-- event = {
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md"
-- "BufReadPre path/to/my-vault/**.md",
-- "BufNewFile path/to/my-vault/**.md",
-- },
dependencies = {
-- Required.
"nvim-lua/plenary.nvim",
},
completion = {
nvim_cmp = true,
min_chars = 2,
},
keys = {
{ "o", desc = "Obsidian" },
{ "oo", "ObsidianOpen", desc = "Open in Obsidian" },
{ "ot", "ObsidianToday", desc = "Today Note" },
{ "oy", "ObsidianYesterday", desc = "Yesterday Note" },
{ "ott", "ObsidianTomorrow", desc = "Yesterday Note" },
{ "ogf", "ObsidianFollowLink", desc = "Follow Link" },
{ "orn", "ObsidianRename", desc = "Rename Note" },
},
opts = {
workspaces = require("plugins.obsidian.workspaces"),
daily_notes = {
folder = "DailyNotes",
date_format = "%Y-%m-%d",
alias_format = "%B %-d, %Y",
-- Optional, if you want to automatically insert a template from your template directory like 'daily.md'
template = nil,
},
new_notes_location = "current_dir",
note_id_func = function(title)
-- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
-- In this case a note with the title 'My new note' will be given an ID that looks
-- like 'my-new-note-1657296016', and therefore the file name '1657296016-my-new-note.md'
local suffix = ""
if title ~= nil then
-- If title is given, transform it into valid file name.
suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
else
-- If title is nil, just add 4 random uppercase letters to the suffix.
for _ = 1, 4 do
suffix = suffix .. string.char(math.random(65, 90))
end
end
return suffix .. "-" .. tostring(os.time())
end,
},
}
```

### Environment

```
NVIM v0.9.4
Build type: RelWithDebInfo
LuaJIT 2.1.1692716794
Compilation: /usr/bin/cc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/build/nvim/parts/nvim/build/.deps/usr/include/luajit-2.1 -I/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/build/src/nvim/auto -I/build/nvim/parts/nvim/build/build/include -I/build/nvim/parts/nvim/build/build/cmake.config -I/build/nvim/parts/nvim/build/src -I/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include -I/build/nvim/parts/nvim/build/.deps/usr/include

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info
Plugins:
[obsidian.nvim (v3.3.1)] Commit SHA: b5945fb94db35220b85c7e3ea7bc58a0b11c2ebc
[plenary.nvim] Commit SHA: 4f71c0c4a196ceb656c824a70792f3df3ce6bb6d
[nvim-cmp] Commit SHA: 04e0ca376d6abdbfc8b52180f8ea236cbfddf782
Tools:
[rg] ripgrep 13.0.0
Environment:
[OS] Wsl
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing ObsidianSearch with the supplied Neovim, obsidian.nvim, plenary.nvim, and ripgrep versions on WSL, then compare its behavior with standalone ripgrep. Done means identifying and fixing the cause of the 10–20 second delay and confirming search results appear promptly.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
performance, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.