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

Search should prefer exact matches, then prefix matches #247

Closed
coke opened this issue Dec 15, 2015 · 8 comments
Closed

Search should prefer exact matches, then prefix matches #247

coke opened this issue Dec 15, 2015 · 8 comments

Comments

@coke
Copy link
Collaborator

coke commented Dec 15, 2015

A search for the string "str" should show Class:Str and Routine:Str as the first choices.

A search for "bef" should sort Infix:before before the exception.

@coke
Copy link
Collaborator Author

coke commented Dec 27, 2015

Think we need #273 first.

@coke
Copy link
Collaborator Author

coke commented Jun 10, 2016

Now that we have categorized matches, how do we want exact matches to be preferred:

  • In each category, exact matches are shown first?
  • Exact matches are pulled to the top of the category listing somehow?

@AlexDaniel
Copy link
Member

Well, I think that the right way to think about it is to take o or X as an example. If we are going to just sort the results in each category, then it's not going to help much in o case.

Not sure if there's a perfect solution. What about having another category called “Exact matches”, listing all exact matches with actual categories in parens?
For example, type x and it will say

==Exact matches==
x (Routine)

And keep other search results below (other search results as implemented right now).

@samcv
Copy link
Collaborator

samcv commented Jan 25, 2017

I think we should list exact matches first. That is what most people would expect.
This would be great:

==Exact Matches==
Str [Class]
Str [Routine]

Atm we have:

==blah==
blah
blah
==blah==
blah
blah
==Class==
blah
blah
blah
blah
blah
blah
Str
blah
blah
blah

@coke
Copy link
Collaborator Author

coke commented Jul 4, 2017

I have a local patch that puts exact matches at the top of the category, followed by prefix matches, with the remaining items in alphabetical order. Everything is still broken out by category.

This worth pushing?

@samcv
Copy link
Collaborator

samcv commented Jul 4, 2017

That's an improvement. Sounds like a good idea to me 👍

@AlexDaniel
Copy link
Member

Yes! Especially if you can mark the matched part with bold or something.

@coke
Copy link
Collaborator Author

coke commented Jul 4, 2017

Added matched part highlight as #1409

coke added a commit that referenced this issue Jul 4, 2017
Sort prefix matches next

Cheat with a global variable to keep track of the last search term

For #247
@coke coke closed this as completed Jul 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants