Prioritize beginning matches in automatic link suggestions

Automatic link suggestions should have a search order which prioritizes pages which begin with the typed text over those that simply contain it.

If I start typing “M”, I very likely want a page that begins with M. What Obsidian offers is every page that has an ‘m’ in it, in seemingly random order. I think the results are good, but the ordering is not. As an example, I wanted to link the page Müspellheimr, which does exist and appears in the list, but I got the results in the following image:

Screenshot from 2020-06-04 12-34-19

Müspellheimr is pretty far down the list, even though I only have a handful of links that start with M. And since the list isn’t even alphabetical, finding the one I want requires either a lot of scrolling and scanning or typing more letters. In my individual case, I have to use Compose Key a lot, and try to avoid it whenever possible, so I’d much rather type “M”, press down arrow a couple times, and hit enter.

6 Likes

If you type more letters does that help?

It “helps” by narrowing down the number of possible matches, but the problem of the ordering still persists. And in some senses adding more letters means less useful results even though there are fewer results. (And in my particular case I’m trying to type as few letters as possible.)

Searching, for example, for Hrymr (which exists):

Screenshot from 2020-06-04 13-45-08

Sometimes you get lucky with a match (i.e., if I was searching for Hrafnagaldr Óðins). But Hrymr doesn’t even appear in the ‘first page’ of the results. And Thor, Heiðrún, etc matching because they contain the letters in the proper order, but not consecutively are basically useless results.

Now, if I type Hrymr of course the correct page pops up, but that kind of defeats the point of the search.

1 Like

I suspect whatever ordering developers create for single-character search, someone will complain about not getting the middle letter next, or last, or second and so on… When I use contextual searches I just type ahead as much as I need to get the job done.

It’s not a request for single character search, but for all search to work by prioritizing results that start with the search term over words in which the search term starts in the middle, which should probably be prioritized over search terms in which the letters are in the correct order but not contiguous.

I strongly suspect the most common use case for users of Obsidian is to use the search as an auto-complete for links they are typing from the beginning of the page name. It’s difficult to see how actual search of page names would be negatively impacted; a predictable search result ordering is probably preferable to an unpredictable one in most cases, unless, say, some context was taken into account based on the text of the target and source pages.

1 Like

Yes, I’m experiencing the same issue and love to have results prioritized. Another weird behavior I’ve noticed:
When I search for “work”, for example, I get my page named “work” in the search results, but pages that have letters in their title in the same order, but spread over multiple words, will also show up.

We improved the fuzzy serch a while back. So this should be fixed.