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

Add enhanced search querying #1455

Open
ellie opened this issue Dec 19, 2023 · 6 comments
Open

Add enhanced search querying #1455

ellie opened this issue Dec 19, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@ellie
Copy link
Member

ellie commented Dec 19, 2023

While we have filter modes, Atuin does not do an amazing job of exposing the contextual information we store in the TUI search

It would be great if searches could work like this in the TUI:

cargo build cwd:~/src exit:0

This would do a normal search for cargo build, but specify that it should only apply to commands that exited successfully in the ~/src dir

We'd probably want to implement the following

name function
after filtering history after a date
before filtering history before a date
cwd filtering by directory
exit filter exit codes
duration filter by command duratio
host filter by hostname (maybe hold off until host aliasing)

Using a proper search engine/index here means that we can search + score results based on a bunch of factors, better using the context we have to provide search results.

@ellie ellie added the enhancement New feature or request label Dec 19, 2023
@dongxuwang
Copy link
Contributor

@ellie do you think this needs a new search mode? otherwise when user input those keywords(cwd: before: ...), the prompt history list would be filtered out.

@atuin-bot
Copy link

This issue has been mentioned on Atuin Community. There might be relevant details there:

https://forum.atuin.sh/t/search-output-order-is-not-what-i-expected/108/2

@ellie
Copy link
Member Author

ellie commented Jan 31, 2024

@ellie do you think this needs a new search mode? otherwise when user input those keywords(cwd: before: ...), the prompt history list would be filtered out.

Yes

Realistically, I'd like to work on one search mode that

  1. Fulfills most needs for most people
  2. Has easy filtering as described above
  3. Is configurable (want to boost directories more than anything else? or time? go for it)
  4. Has proper search engine features (ngrams, operators, etc)
  5. Does not require loading all data in memory (like fzf, etc). We now have users with >1m history lines stored, so that cannot be relied upon to be fast

I'd like to explore Tantivy for this use case. SQLite FTS could perhaps do it, but is not quite as flexible as I'd like

Given that this has an extra index step, making it dependent on #1661 probably make sense

@atuin-bot
Copy link

This issue has been mentioned on Atuin Community. There might be relevant details there:

https://forum.atuin.sh/t/a-regex-search-mode/169/5

@saroh
Copy link

saroh commented Feb 28, 2024

I'd like to explore Tantivy for this use case. SQLite FTS could perhaps do it, but is not quite as flexible as I'd like

Hi 👋
I have a few contributions to tantivy, I'd be happy to answer any question you may have or give a hand.
Beyond the use of the query language you're puting forward here, I think the aggregation and filtering capabilities could be of use in the inspect tab.

@ellie
Copy link
Member Author

ellie commented Feb 28, 2024

I have a few contributions to tantivy, I'd be happy to answer any question you may have or give a hand.

Thanks! I'll let you know for sure

As an update here; I recently had another go with sqlite fts, just to avoid adding another system if not needed. It got maybe 80% of the way there, but wasn't quite as nice as I had hoped. I'll have a go with tantivy soon

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

4 participants