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

Interleaves search results across categories #706

Merged
merged 5 commits into from
Jun 17, 2024

Conversation

JasonWeill
Copy link
Contributor

Fixes jupyterlab/jupyterlab#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

@JasonWeill JasonWeill added the enhancement New feature or request label May 29, 2024
@fcollonval
Copy link
Member

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

@krassowski
Copy link
Member

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 JasonWeill changed the title Allows interleaving of search results Interleaves of search results across categories May 30, 2024
@JasonWeill
Copy link
Contributor Author

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 JasonWeill changed the title Interleaves of search results across categories Interleaves search results across categories May 30, 2024
@JasonWeill
Copy link
Contributor Author

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

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JasonWeill

@JasonWeill JasonWeill merged commit d98765d into jupyterlab:main Jun 17, 2024
17 checks passed
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

Successfully merging this pull request may close these issues.

Command palette not searching for keywords correctly
3 participants