Sort search results by relevance (and what relevance is)

There were more suggestions as to how to present search results. I suggest having option to sort by relevance. It would solve more feature requests - see below. What relevance might mean - I suggest it encompasses following and in following order (which is of course subject of further discussion):

  1. filename (if searched word is found in filename, it is definitely highest relevance and should be presented first - it is default functionality in apps like Notational Velocity etc) - (more this forum thread)

  2. occurence in headers/bolded text/empasis etc. (in this order) (cf this forum thread)

  3. occurence within tag

  4. number of occurences in a note (more this forum thread)

  5. occurence within link text

  6. occurence in normal text


Other factors, as popularity / “last open” / “last modified” could be also taken into account. (more in this forum thread)

15 Likes

The problem is that there really is no sensible metric for “relevance” in this context, so it really doesn’t make a lot of sense to offer it as an option in the system.

If there was some way to build your own “relevance metric” within the system, possibly by reference to a set of rules which you assemble for yourself, it might have a purpose. But I have yet to find a relevance metric for searching PKM systems which is actually useful for me all the time.

Some kind of modular metric mechanism that can be used for all sorts of things? Maybe useful. But definitely outside the current scope of Obsidian as I understand it.

@LexTenebris: do not think we need sophisticated metrics for this feature. Just basic order that I suggested might be such “metrics” (rules). E.g. when search term is part of the title of the note, we can consider it to be more important and to appear first. The same is valid for headers etc. So if searched term belongs to one of such groups, the note would appear in respective order as these groups are (= found searches in: note titles - headers - bolded - multiple occurrences etc …). I believe there is general accord that words in titles, bolded etc. have higher relevance (actually, that is why they appear in title, as bolded text etc - because we consider them relevant.)

As for more complicated “relevance metrics”, I believe it could be done later (maybe using some plugin/AI/third party app via API) as it is done in DevonThink. But I agree, it is outside current Obsidian scope now.

But simple relevance as suggested above could be easily implemented (and in fact, in basic form - in which found searches in note titles have precedence before found words in note text - is already implemented in majority of similar apps - Notational Velocity, FSNotes, The Archive etc)

2 Likes

+1 to this request.

Any note taking app that offers a ‘relevance’ search is just the developer’s opinionated answer to that question. Sure, there’s no single metric that works for all cases, but working reasonably well in a lot cases is better than not having it at all.

1 Like

As I add more notes this is becoming a bigger and bigger issue for me. The search brings up way too many results even though there is a clear correct, most relevant result. It’s starting to feel a little like I am doing all the hard work with the links and tags and folders and naming conventions, etc. but I know that’s not necessary to get good results. A good search engine can rank based on interpreting the searcher’s intent. I think this is a core “must have” feature.

1 Like

I’ll agree with this.

An example:
I have work and personal stuff in my notes. I searched for family meeting. I had hundreds of meeting results at the top of the results (work meetings).

Exact match should be more relevant than fuzzy match.

To find what I wanted I had to search "family meetings" (quotes). That worked in this example b/c I knew exactly what I probably typed.

1 Like

Use case or problem

When I search for something, I don’t necessarily put it between quotes. I expect that close-enough matches will appear in some kind of relevant order. Currently, Obsidian shows partial matches before complete ones, making me mistakenly believe that the search was unsuccessful.

I’ve used the Help Vault as an example: searching for this is a heading without quotes seems to return no close matches, but those are actually “hidden” behind that "…and 247 matches"; if we expand it, several full matches appear further down the list.

Proposed solution

I don’t know the inner workings of Obsidian’s search. Even if I did, I’m not sure I’d be able to propose a solution. I just think it could use some more love.

Current workaround (optional)

We can always expand the results one by one, or explicitly search for a phrase using quotes. But it seems counterintuitive and unforgiving.

8 Likes

I’ve seen requests for Smart sorting of search results. This is the simplest (and most common) example.

We need it for large vaults, as our work in Obsidian expands.

It would be helpful to be able to quickly see in which note a topic is discussed THE MOST. Similar to how Devonthink and Evernote can sort by ‘relevance’.

So a note that has the word ‘Agency’ in it 20 times would show above a note that just happens to have ‘Agency’ in it once.

It wouldn’t be the only way to sort results and links, the existing ones are excellent, but as a sort option.

13 Likes

Running into this same feature gap right now - what I’m searching for my #todo tag, I want to see the note with the most such tags in it at the top, rather than date or alphabetical sorting.

1 Like

+1

Also, I’d love if I could hit up,down (or cmd+j, cmd+k) to navigate the search results without having to click on the results with my mouse.

(Apologies if this should be a different request)

Using search you can change sort order. But there is no option to sort by frequency. what I mean is if a search keyword has many occurrences in a note. you can to be able to get that note first in sort order when searching.

1 Like

Add your support to the feature request here:

+1 for this. Giving results alphabetically is annoying

1 Like

+1 for the feature to have the sort option by hits for each file. The file with the most hits for a search pattern should be the first. Would be absolutly great <3 :heart_eyes: and thank you for this great software! :slight_smile: