Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of the search results seems to be wrong / suboptimal #22

Open
Nelvin opened this issue May 31, 2023 · 7 comments
Open

Order of the search results seems to be wrong / suboptimal #22

Nelvin opened this issue May 31, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@Nelvin
Copy link

Nelvin commented May 31, 2023

Hi,
could you explain the sorting of the search results as I have cases where even the exact written filename of a note doesn't end in the first, and so autocomplete, spot of the results (see the screenshot).
In this case it's only on position 3 and the first listed is completely irrelevant to my search, neither the file/notes name nor the actual content includes what I searched for.
Thanks

image

@Garulf
Copy link
Owner

Garulf commented May 31, 2023

I believe I have a way to fix this. I'll try and get to this when I can.

Thank you for using my plugin.

@Garulf Garulf added the good first issue Good for newcomers label May 31, 2023
@Garulf Garulf self-assigned this May 31, 2023
@Garulf Garulf added enhancement New feature or request and removed good first issue Good for newcomers labels May 31, 2023
@Nelvin
Copy link
Author

Nelvin commented Oct 7, 2023

Hi Garulf,
just wanted to give the plugin another try and had a look at the source myself as I'd be fine to do small fixes / adjustments on my own.
After trying to fiddle around with the scoring I wanted to see the actual numbers and modified the title string of the notes to include the calculated match scores (when calling add_item in the query method in main.py).

What I expected was the identical order of results with just some numbers added to the title text.
What I got was a completely different order of results.

You can check this by just modifying the Line.
title=note.title,
into
title=note.title + f"{score} {title_score}",
This confused my as I expected the sort order is based on the score value which I didn't touch at all.

Would be great if you could try this on your side and tell me what I may be missing wrt the score/sorting of the results.

@Garulf
Copy link
Owner

Garulf commented Oct 7, 2023

Python plugins do not have access to Flows scoring functions.

I experimented with fuzzy matching in other plugins but found results to be subpar. The Obsidian plugin doesn't use any scoring but simple shows any item that contains your search query.

Eventually I was able to port Flows search algorithm to Python however I have not had a chance to add it to this plugin yet.

With Flows plugin version 2 almost ready it might be better to wait so that it can use the search algorithm directly from Flow.

@Nelvin
Copy link
Author

Nelvin commented Oct 8, 2023

I see - explains why little hacks I tried to tweak scoring just to understand the resulting sorting didn't make any sense :)
Looking forward to version 2 then.

Thanks for your answer

@AlanEdd
Copy link

AlanEdd commented Aug 7, 2024

Hey there - just checking in to see if this was ever adjusted or fixed. It seemed to be perfect on install but it doesn't seem to update or reindex properly?

image

The workaround or expected behaviour by using the normal Explorer search within the Obsidian vault:
image

Thanks!

@Garulf
Copy link
Owner

Garulf commented Aug 7, 2024

Hi @AlanEdd,

Currently the plugin simple matches by filename. Would matching by path be useful?

@AlanEdd
Copy link

AlanEdd commented Aug 9, 2024

Well I am not sure how it matches but the exact file name above:
"ae tips" puts result in 11th place
"ae ToDo" is in first place?

When I add another word
"ae tips new"
The file moves to the top.
So I think it's just the fuzzy search settings. I won't pretend to understand! but searching by "notes\ md " in normal Flow search works better for me for now.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants