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

Can search results be sorted by relevance #3357

Closed
LL12138LL opened this issue Jun 14, 2022 · 4 comments · Fixed by #4042
Closed

Can search results be sorted by relevance #3357

LL12138LL opened this issue Jun 14, 2022 · 4 comments · Fixed by #4042
Assignees
Labels
Area-Search Related to file search. Issue-Feature A feature request or improvement.
Milestone

Comments

@LL12138LL
Copy link

LL12138LL commented Jun 14, 2022

Is your feature request related to a problem? Please describe.
When I search for some files with short names, I find it hard to find them because of too many search results

Describe the solution you'd like
Can search results be sorted by relevance

Additional context

0d444f00d86d429640183d8e51f625fe.mp4
@EmmanuelMess EmmanuelMess added Issue-Feature A feature request or improvement. Area-Search Related to file search. labels Jun 15, 2022
@seelchen
Copy link
Contributor

Hi, I would like to work on this.

My proposed sorting by relevance would be (from most to least important criteria):

  1. Sort based on percentage matched. We would calculate how much of the name of a file is found in the search term (e.g. the search term "my" would match 20% in "my-cat.txt")
  2. Prioritize files where the match is in the beginning of the name (e.g. with the search term "my", "my-cat.txt" would be prioritized before "rat-my.txt")
  3. Prioritize files where the match could be a whole word in the file name (because it is separated with "-"/"_"/"."/space, e.g. with "my" as search term, "my-cat.txt" is prioritized before "mysterious")
  4. Date modified

I also think than directories should not appear first in the search results but should be ranked with the same weight as files.

It might also be helpful to be able to select which sorting should be applied, e.g. by relevance, by name, by date modified etc.

@VishnuSanal
Copy link
Member

@seelchen hi, great to see that you are interested in working on Amaze. there's a new search technique being implemented in #3730. please see this discussion for more details. let's discuss this new behavior before you start working on it.

@seelchen
Copy link
Contributor

Hi, thank you for the pointers!
I looked at the new search technique and it seems like the results are displayed in the order in which they are loaded in ListFileCommand#listFiles (which doesn't explicitly give any guarantees about the order). The old search is also used as DeepSearch. I think that sorting by relevance could improve the usability for all three search modes.

@seelchen
Copy link
Contributor

My plan is to reuse the FileListSorter to sort both LayoutElementParcables (used in old search) and HybridFileParcelables (used in new search). I would need make them both implement a new interface to access the information needed for sorting. The sorting would be done after all items are found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Search Related to file search. Issue-Feature A feature request or improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants