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

Better/more expressive search filters #112

Closed
conradludgate opened this issue May 11, 2021 · 2 comments
Closed

Better/more expressive search filters #112

conradludgate opened this issue May 11, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@conradludgate
Copy link
Collaborator

Currently, it seems that search filters are quite limited. For instance, you can only have 1 optional directory filter. Also, for interactive mode, you cannot update these filters while in the tui.

I think this would ultimately require a large rewrite of the search code.

Current filters:

  • cwd
  • exclude_cwd
  • exit
  • exclude-exit
  • before
  • after

These all currently only accept up to a single value and they're all duplicated with this conflicting filters.

I'm imagining a system like atuin search cwd not "$HOME" and time between 2021-04-01 and 2021-05-01

And then there could be a keybinding in the interactive mode to replace the text box with the filter editor.

@conradludgate
Copy link
Collaborator Author

conradludgate commented May 11, 2021

@conradludgate conradludgate added the enhancement New feature or request label May 11, 2021
@ellie
Copy link
Member

ellie commented May 12, 2021

Sorry, I've taken a while to get to this one. I also hate saying no to all of this because it sounds really fun 😭

Much as queries like you propose sound really cool, I definitely don't want to be adding a DSL (or similar) to Atuin. That's complexity that's totally not needed + I think would cause more issues in the long run.

I think most of the current issues we have with lack of expressiveness can be solved via implementing two things

  1. Allow multiple query flags (so atuin search --exit 0 --exit 1 --cwd $HOME --cwd . etc etc)
  2. Allowing SQL searches. These could be automatically prefixed with select * from history to make life easier

And then there could be a keybinding in the interactive mode to replace the text box with the filter editor.

I'd rather keep the keybindings fairly minimal. Something like Ctrl-r to switch between "search global", "search dir", "search session" would be nice.

We could have a flag + config for searching with SQL, which can then be overridden per-directory in a similar method as proposed here: #116 (comment). We should also encourage users to add their own keybindings - there's really nothing to stop people from adding another binding to search via some other filter, and arguably that belongs in the shell anyway.

99% of the time I don't think people will be wanting to run particularly advanced queries

One of the things I'd like to keep with Atuin is that people don't spend very long in the TUI. It should be quick to open, quick to find what you want, and quick to close - composing queries in it run counter to that.

Also... Tantivy is lovely and it would be super cool to include it. It would make it very easy to boost results by directory/session/whatever. However, we currently massively underutilize SQLite and I think we can get the same sorts of behaviour with some smarter search queries

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

No branches or pull requests

2 participants