jupyterlab / lumino

Lumino is a library for building interactive web applications
https://lumino.readthedocs.io/
Other
598 stars 127 forks source link

Interleaves search results across categories #706

Closed JasonWeill closed 1 week ago

JasonWeill commented 1 month ago

Fixes https://github.com/jupyterlab/jupyterlab/issues/9659.

Allows search results in the command palette to be interleaved across groups.

Before the change, low-scoring search results are still grouped together, leaving higher-scoring search results in other groups lower:

Screenshot 2024-05-29 at 4 46 48 PM

After the change, search results are strictly sorted in descending score order. Headers for the same group may occur more than once. If two successive search results have the same header, then we don't display a new header.

Screenshot 2024-05-29 at 4 35 20 PM
fcollonval commented 1 month ago

Thanks @JasonWeill would you mind adding a test for this? And the linter is not happy :wink:

krassowski commented 4 weeks ago

Could it be an option to have either one or the other behaviour?

Od note the headings are still shown in JupyterLab when using command palette in the sidebar and the old behaviour makes more sense there.

The PR title also suggest that this is an addition of an option rather than a change in behaviour

JasonWeill commented 4 weeks ago

I've added a unit test specifically about search, using a similar command palette setup to one of the example files.

I don't think that this should be an option. Searching for commands by a keyword should return the highest-scoring results first. What is the value of displaying many low-score results in a large category, pushing down a high-scoring result from another, smaller, category?

JasonWeill commented 3 weeks ago

@fcollonval Added a unit test for the search functionality. I'd appreciate if you could review when you get the time. Thanks!