workbenchdev / Biblioteca

Documentation viewer for GNOME
GNU General Public License v3.0
57 stars 9 forks source link

Show classes first when searching #60

Open A6GibKm opened 11 months ago

A6GibKm commented 11 months ago

When searching for e.g. "scrolledwindow" the GtkScrolledWindow class is not in the first page of results. While one can enter any method and go up, it might make sense to sort the results so that the classes appear first.

AkshayWarrier commented 11 months ago

I'm actually not quite sure how we can do this. The search results are found using fzy.js which is the module used by gi-docgen as well for fuzzy searching. When someone searches for scrolledwindow, there's no way to know the intention of the user whether they want the class or a method on scrolled window. If we just increase the score of all results which are classes so that they appear at the top, then searching for say "button" will just give GtkButton, AdwTabButton, FontButton...etc before any of the methods or properties of button start. I think it becomes hard to find a good balance.

I understand your point that it's easy to go from a class to a method/property, but if someone just simply wants search for a property or a method it might become harder to find it.