darlal / obsidian-switcher-plus

Enhanced Quick Switcher plugin for Obsidian.md
GNU General Public License v3.0
417 stars 11 forks source link

Open in Editor mode produces extraneous matches... #157

Open skirsch opened 3 months ago

skirsch commented 3 months ago

See this image: image The text "oracle" doesn't appear in several of these "matches" (like Create Bootable and the Cloudberry one).

And it ALWAYS shows the current tab name and "Backlinks for current tab name" In this case, I was on "Create Bootable ISO ..."

This seems to be a bug and it's repeatable.

Also, I'd like the search to ONLY match the text in the title of the open tab. I have zillions of tabs open and I'd like to switch with the search matching just the TITLES.

I'm happy to make a generous donation if you can fix these two things.

Also, happy to do interactive debugging to get to the root of the problem.

FANTASTIC work.... super impressive.

darlal commented 3 months ago

Hi there, glad you're finding the plugin useful. There are a few things happening here, so I'll try to call them out separately.

it ALWAYS shows the current tab name and "Backlinks for current tab name"

This is a feature of Switcher++ and is configurable. Editor mode enables you to switch between active editors and "Side panel" views ("Backlinks for current tab name" is a Side panel view). See Include side panel views setting documentation for details.

I'd like the search to ONLY match the text in the title of the open tab

The "Title" of a tab could be several different things, 1) the filename without path 2) the first H1 heading 3) some Obsidian generated text (usually also containing filename). The setting Preferred suggestion title source allows you to configure which one is prioritized when searching. Here's the important bit, if a match is not found in the preferred title source, it falls back to searching the whole filepath. When there's a match in the fallback search, it is scored much lower than the preferred source match would be.

The text "oracle" doesn't appear in several of these "matches" (like Create Bootable and the Cloudberry one)

Switcher++ uses the Obsidian builtin fuzzy search feature. Fuzzy search allows there to be partial matches for the word you're looking for (so in this case, you might get non-sequential matches for the word "oracle").

For the results where the word "oracle" does not appear in the "Title", take a closer look at the filepath for those results, you'll see that there is a fuzzy match in the filepath. What's happening is that there was no match in the title, which causes it to fallback to searching the filepath, and fuzzy matching there (you can see the matched text is highlighted differently). search

Hopefully this sheds some light on the behavior you are seeing. Thanks!

skirsch commented 1 week ago

well I see that now, but it's super confusing for those who are relative newbies to Obsidian.

I can think of 2 solutions to avoid future bug reports.

  1. don't use the fuzzy match... it's not needed for these cases
  2. Put the fuzzier matches in a section at the bottom

I'd prefer #1.

thanks for writing this plugin it's amazing.