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

fix analyzer lookup when field name contains dot #1496

Merged
merged 2 commits into from
Nov 11, 2020

Conversation

mschoch
Copy link
Contributor

@mschoch mschoch commented Nov 11, 2020

At query time, we sometimes attempt to lookup the correct
analyzer for a field. When doing so, the "." character can
be interpretted as a path separater. Doing this can result
in lookup failure in cases where the user specified a field
name which also contains a dot.

This fix addresses the case where the path contains a dot,
but the next element does not match a mapping at this level.
Previously this ended all looukp in this mapping, now we
attempt to match the remaining path as a whole, without
splitting on the dot.

This fix is intended to fix most common cases where a user has
given a field a name with a dot. However, ambigutities
between custom field names containing dots, and actual mapping
paths can still happen, and must be manually avoided.

At query time, we sometimes attempt to lookup the correct
analyzer for a field.  When doing so, the "." character can
be interpretted as a path separater.  Doing this can result
in lookup failure in cases where the user specified a field
name which also contains a dot.

This fix addresses the case where the path contains a dot,
but the next element does not match a mapping at this level.
Previously this ended all looukp in this mapping, now we
attempt to match the remaining path as a whole, without
splitting on the dot.

This fix is intended to fix most common cases where a user has
given a field a name with a dot.  However, ambigutities
between custom field names containing dots, and actual mapping
paths can still happen, and must be manually avoided.
@mschoch mschoch force-pushed the fix-analyzer-lookup-field-name-with-dot branch from a5840e1 to 2358b82 Compare November 11, 2020 18:01
@mschoch mschoch changed the title fix analyer lookup when field name contains dot fix analyzer lookup when field name contains dot Nov 11, 2020
@mschoch
Copy link
Contributor Author

mschoch commented Nov 11, 2020

I did a force push, which I usually avoid, to correct a typo in the commit message.

Copy link
Member

@abhinavdangeti abhinavdangeti left a comment

Choose a reason for hiding this comment

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

Looks good to me!


analyzerName := indexMapping.AnalyzerNameForPath("geo.geo.accuracy")
if analyzerName != "xyz" {
t.Errorf("expected analyzer name `xyz`, got `%s", analyzerName)
Copy link
Member

Choose a reason for hiding this comment

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

Missed a trailing back-quote after %s

@mschoch mschoch merged commit 4b6bddf into master Nov 11, 2020
@mschoch mschoch deleted the fix-analyzer-lookup-field-name-with-dot branch November 11, 2020 18:49
@mschoch mschoch added this to the v1.0.13 milestone Nov 20, 2020
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.

2 participants