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
Move split_full_path
to Schema
#1692
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1692 +/- ##
==========================================
+ Coverage 93.96% 94.05% +0.09%
==========================================
Files 256 256
Lines 48986 49291 +305
==========================================
+ Hits 46031 46363 +332
+ Misses 2955 2928 -27
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
||
/// Searches for a full_path, returning the field name and a json path. | ||
pub fn find_field<'a>(&self, full_path: &'a str) -> Option<(Field, &'a str)> { | ||
if let Some(field) = self.0.fields_map.get(full_path) { |
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.
No unit tests for find_field!? Can we add some?
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 mostly copied the same unit test on QueryParser
. I can remove the test from QueryParser
or add more tests to Schema
if that's what we want.
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 please that would be awesome!
/// If it's not, it splits the full_path at non-escaped '.' chars and tries to match the | ||
/// prefix with the field names, favoring the longest field names. | ||
/// | ||
/// This does not check if field is a JSON field. It is possible for this functions to |
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.
Would it make sense to improve the spec and avoid this?
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.
It might be. I changed the function to continue when the prefix is not a JSON field, and all of the tests passed (probably does not mean it is completely ok to change), but I think it might be better to open a separate PR for it.
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.
Can you open a ticket?
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.
Having this method on the
Schema
level will help simplify the code on Quickwit for the issue quickwit-oss/quickwit#2260.Also, this comes with a bonus of removing the
field_names
hashmap fromQueryParser
.