-
Notifications
You must be signed in to change notification settings - Fork 23
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
Create a scaffold for a search app. #188
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #188 +/- ##
=====================================
Coverage 75.0% 75.0%
=====================================
Files 44 44
Lines 2871 2871
=====================================
Hits 2156 2156
Misses 715 715 ☔ View full report in Codecov by Sentry. |
This is the commit where I removed the search command before the release 0.1.0. That should help initiate this task. See the files removed under src/search for more details. |
src/registry/search.rs
Outdated
let schema = resolve_semconv_specs(&mut registry, logger.clone())?; | ||
|
||
// TODO - We should have two modes: | ||
// 1. An interactive UI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the interactive mode, see this commit 96e2c13 path=src/search.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some of this. The goal is to actually not be good enough that folks think this is a complete feature, but also be good enough that folks know what/how to contribute more.
Regarding what to return from search, how to architect a UI, whether to use a search index, etc. I think we should punt for now. This is meant to be just enough to gain contributions and make it "not as hard" to get started.
@@ -74,6 +74,9 @@ weaver_forge = { path = "crates/weaver_forge" } | |||
weaver_checker = { path = "crates/weaver_checker" } | |||
|
|||
clap = { version = "4.5.4", features = ["derive"] } | |||
rayon = "1.10.0" | |||
ratatui = { version = "0.26.3", features=["serde"] } | |||
crossterm = { version = "0.27.0", features = ["serde"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used Tantivy for the search
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'd like whomever takes this over to decide on a longer term search algorithm and what's important here.
For now, it's just a fast lookup on attributes to showcase what could be. Your code could be ressurected at some point, but I also don't think we should tie this knot tightly to the datamodel until we find someone willing to own/dedicate time to the UI.
I.e. If this code causes breakages when folks add/alter the data model, it has a 'weight' to it for making changes. I'd like to avoid that until we have commitment/time to invest. It may be one of us does that investment, but I'm trying to save us from that for a time. IF someone is dedicated to this UI, i'd be happy to accept more rich/robust implementations.
285215a
to
781a009
Compare
… to follow along. Also some help on lifetime associations with registry.
…things to hopefully get someone else to implement a richer UI.
@lquerel This is ready for review. See my comments to your initial comments. The goal of this is NOT completeness. It's meant to be "bare bones" enough someone can take this and make it whatever in the future, but also NOT a burden for us to evolve weaver going forward if it exists. This is why I didn't opt for anything more than iterator-based searching and only support displaying Attributes for now. We should still have room to alter data model without updating rendering code here, which I expect we'll need as we worked towards "application schema" stabilziation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment regarding one of the messages displayed to the console.
src/registry/search.rs
Outdated
.title("Weaver Search"); | ||
let title_contents = Line::from(vec![Span::styled( | ||
format!( | ||
"Loaded {0:?} registries w/ {1} attributes", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the registry the entire set of groups starting with registry. or is each group starting with registry. considered an individual registry? If as I think it's the former then message should be something like "Loaded {0:?} groups w/ {1} attributes".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither... but I think reporting groups makes more sense :) Will update.
src/registry/search.rs
Outdated
let group_count: usize = self | ||
.schema | ||
.registries | ||
.iter() | ||
.map(|(_, r)| r.stats().group_count) |
Check failure
Code scanning / clippy
iterating on a map's values Error
src/registry/search.rs
Outdated
let group_count: usize = self | ||
.schema | ||
.registries | ||
.iter() | ||
.map(|(_, r)| r.stats().group_count) |
Check failure
Code scanning / clippy
iterating on a map's values Error
This just sets up an initial architecture with all components in place to make it easier for someone to learn Ratatui/Crosstool with a resolved schema and implement searching features.
The goal of this is NOT completeness. It's meant to be "bare bones" enough someone can take this and make it whatever in the future, but also NOT a burden for us to evolve weaver going forward if it exists.
Hopefully someone wanting to learn Rust and/or Weaver sees this and decided to contribute/drive this forward.