Fix linearize_dict to handle optional parent objects in highlights#19
Merged
Fix linearize_dict to handle optional parent objects in highlights#19
Conversation
63ef9aa to
ec839f8
Compare
Capture the old highlight derivation behavior with one optional parent object and one non-optional sibling object. The buggy output collapses the optional path to ~content while the non-optional path still flattens to ~summary_text. Leave test/highlight_optional_parent/query.ml out of git because generated query files are ignored.
Highlight fields should stay flattened even when a parent object is optional. Elasticsearch returns flat dotted highlight keys regardless of parent optionality. Update the regression output so both the optional content path and the non-optional summary path flatten to leaf highlight fields.
8b96954 to
fc1eb53
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a parent field in the ES mapping is marked as optional, highlight field derivation would generate a nested type instead of the correct flat structure. ES highlights always use flat dotted keys regardless of parent optionality, so linearize_dict should recurse through Maybe(Dict) the same way it recurses through Dict.