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

Move split_full_path to Schema #1692

Merged
merged 5 commits into from Nov 29, 2022

Conversation

boraarslan
Copy link
Member

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 from QueryParser.

src/schema/schema.rs Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2022

Codecov Report

Merging #1692 (01bdf6f) into main (9a090ed) will increase coverage by 0.09%.
The diff coverage is 92.09%.

@@            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     
Impacted Files Coverage Δ
fastfield_codecs/src/column.rs 93.68% <ø> (-0.10%) ⬇️
src/indexer/index_writer.rs 96.77% <0.00%> (ø)
src/tokenizer/stop_word_filter/mod.rs 68.00% <0.00%> (+18.96%) ⬆️
src/query/query_parser/logical_ast.rs 80.00% <58.82%> (-8.38%) ⬇️
src/query/query_parser/query_parser.rs 94.90% <90.32%> (-0.14%) ⬇️
query-grammar/src/query_grammar.rs 99.69% <100.00%> (+<0.01%) ⬆️
query-grammar/src/user_input_ast.rs 98.09% <100.00%> (+0.22%) ⬆️
src/fastfield/multivalued/reader.rs 88.95% <100.00%> (+5.34%) ⬆️
src/indexer/json_term_writer.rs 99.79% <100.00%> (+0.05%) ⬆️
src/indexer/mod.rs 100.00% <100.00%> (ø)
... and 11 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

src/schema/schema.rs Outdated Show resolved Hide resolved

/// 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) {
Copy link
Collaborator

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?

Copy link
Member Author

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.

Copy link
Collaborator

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
Copy link
Collaborator

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?

Copy link
Member Author

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.

Copy link
Collaborator

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fulmicoton fulmicoton merged commit 4958243 into quickwit-oss:main Nov 29, 2022
ppodolsky pushed a commit to izihawa/tantivy that referenced this pull request Dec 8, 2022
This was referenced Jan 13, 2023
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

Successfully merging this pull request may close these issues.

None yet

4 participants