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

Suggestion: Add support for sort in the free text search #59

Open
DannyBen opened this issue May 18, 2020 · 4 comments
Open

Suggestion: Add support for sort in the free text search #59

DannyBen opened this issue May 18, 2020 · 4 comments

Comments

@DannyBen
Copy link

It would be super nice if the free expression search would support sorting, so we can do:

User.search "status = active and comments > 1 sort : -joined_on"

or some other human-friendly syntax. Here I assumed - for descending order, and + (or no prefix) for ascending order.

Is this considered out of scope for search_cop?
I just find myself beginning to enjoy just giving the users a single search field, but now I still have to provide them with "Sort By" UI controls, which I would love to retire as well.

@mrkamel
Copy link
Owner

mrkamel commented May 18, 2020

Hi, sorry, but i'd consider this to be out of scope and I don't see a strong use case for it, as i don't think anyone will ever remember the syntax for it and a simple select box usually is sufficient. Moreover, i think it can overcomplicate things and i don't know any searchengines (like elasticsearch or so) which have something like that

@DannyBen
Copy link
Author

Well - that is of course your call, but it does exist, closer than you think 😄 ...
https://github.com/mrkamel/search_cop/issues?q=is%3Aissue+is%3Aopen+sort%3Acreated-asc

image

This is the concept of "everything is an expression" - Github still has UI controls to assist, but they just autofill the search expression.

@mrkamel
Copy link
Owner

mrkamel commented May 18, 2020

interesting. thx for pointing this out.

@DannyBen
Copy link
Author

By the way, I found another glorious page on GitHub that demonstrates the use of this very nicely. This is what I would like to implement with search cop in my systems.

See this: https://github.com/pulls?q=is%3Aclosed+is%3Apr+author%3ADannyBen

Notice that:

  1. The entire expression is in the URL
  2. The buttons on top change the expression
  3. The sorting and other options on the right also change the expression.

From development standpoint, Github team just implemented a very smart expression mechanism, which provides advantages to all stakeholders:

  1. The developers are not asked every day to "add another search feature / field"
  2. The UI guys can create buttons and select boxes to inject phrases to the expression
  3. The average user has a nice UI
  4. The advanced user has a smart expression box.

As far as I know, SearchCop is the closest gem to being able to enable such a dreamy functionality.

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

2 participants