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

Allow using distance measure in the geo context precision #29273

Merged

Conversation

Projects
None yet
5 participants
@imotov
Copy link
Member

commented Mar 28, 2018

Adds support for distance measure, such as "4km", "5m" in the precision
field of the geo location context in context suggesters.

Fixes #24807

Allow using distance measure in the geo context precision
Adds support for distance measure, such as "4km", "5m" in the precision
field of the geo location context in context suggesters.

Fixes #24807
@elasticmachine

This comment has been minimized.

Copy link
Collaborator

commented Mar 28, 2018

Pinging @elastic/es-search-aggs

@cbuescher cbuescher self-assigned this Mar 28, 2018

@cbuescher
Copy link
Member

left a comment

@imotov looks good to me, left a some minor comment that don't really need another review once adressed.

parser.nextToken(); // {
parser.nextToken(); // field name
parser.nextToken(); // field value
return GeoUtils.parsePrecision(parser);

This comment has been minimized.

Copy link
@cbuescher

cbuescher Apr 3, 2018

Member

Just for completeness, can we check that the current token pointer after parsing is as expected, e.g. by consuming the remaining tokens and asserting that they are closing elements or something like that?

}
}

public static int checkPrecisionRange(int precision) {

This comment has been minimized.

Copy link
@cbuescher

cbuescher Apr 3, 2018

Member

Can you add a short javadoc?

imotov added some commits Apr 3, 2018

@jpountz

jpountz approved these changes Apr 4, 2018

Copy link
Contributor

left a comment

I know you mostly moved some code around but I left some suggestions for improvements. Looks good to me regardless.

@@ -459,6 +459,50 @@ public static GeoPoint parseGeoPoint(XContentParser parser, GeoPoint point, fina
}
}

/**
* Parse a precision that can be expressed as an integer or a distance measure like "1km", "10m".

This comment has been minimized.

Copy link
@jpountz

jpountz Apr 4, 2018

Contributor

Maybe mention that this "precision" is the geohash length?

String precision = parser.text();
try {
// we want to treat simple integer strings as precision levels, not distances
return XContentMapValues.nodeIntegerValue(Integer.parseInt(precision));

This comment has been minimized.

Copy link
@jpountz

jpountz Apr 4, 2018

Contributor

you should call either parseInt or nodeIntegerValue, not both?

} catch (IllegalArgumentException e3) {
// this happens when distance too small, so precision > 12. We'd like to see the original string
throw new IllegalArgumentException("precision too high [" + precision + "]", e3);
}

This comment has been minimized.

Copy link
@jpountz

jpountz Apr 4, 2018

Contributor

should we catch separately the call to checkPrecisionRange and geoHashLevelsForPrecision?

@jpountz

jpountz approved these changes Apr 4, 2018

@imotov imotov merged commit 2c20f7a into elastic:master Apr 4, 2018

2 checks passed

CLA Commit author is a member of Elasticsearch
Details
elasticsearch-ci Build finished.
Details

imotov added a commit that referenced this pull request Apr 4, 2018

Allow using distance measure in the geo context precision (#29273)
Adds support for distance measure, such as "4km", "5m" in the precision
field of the geo location context in context suggesters.

Fixes #24807

martijnvg added a commit that referenced this pull request Apr 5, 2018

Merge remote-tracking branch 'es/master' into ccr
* es/master: (68 commits)
  Allow using distance measure in the geo context precision (#29273)
  Disable failing query in QueryBuilderBWCIT.
  Fixed quote_field_suffix in query_string (#29332)
  Use fixture to test repository-url module (#29355)
  Remove undocumented action.master.force_local setting (#29351)
  Enhance error for out of bounds byte size settings (#29338)
  Fix QueryAnalyzerTests.
  Fix HasChildQueryBuilderTests to not use the `classic` similarity.
  [Docs] Correct javadoc of GetIndexRequest (#29364)
  Make TransportRankEvalAction members final
  Add awaits fix for a query analyzer test
  Check presence of multi-types before validating new mapping (#29316)
  Add awaits fix for HasChildQueryBuilderTests
  Remove silent batch mode from install plugin (#29359)
  Align cat thread pool info to thread pool config (#29195)
  Track Lucene operations in engine explicitly (#29357)
  Build: Fix Java9 MR build (#29312)
  Reindex: Fix error in delete-by-query rest spec (#29318)
  Improve similarity integration. (#29187)
  Fix some query extraction bugs. (#29283)
  ...

martijnvg added a commit that referenced this pull request Apr 5, 2018

Merge remote-tracking branch 'es/6.x' into ccr-6.x
* es/6.x: (68 commits)
  Add note to migration docs on silent batch mode (#29365)
  Allow using distance measure in the geo context precision (#29273)
  Disable failing query in QueryBuilderBWCIT.
  Improve similarity integration. (#29187)
  Fix some query extraction bugs. (#29283)
  Fixed quote_field_suffix in query_string (#29332)
  TEST: Update negative byte size setting error msg
  Fix bwc in GeoDistanceQuery serialization (#29325)
  Move testMappingConflictRootCause to different class
  Enhance error for out of bounds byte size settings (#29338)
  [Docs] Correct javadoc of GetIndexRequest (#29364)
  Check presence of multi-types before validating new mapping (#29316)
  Make TransportRankEvalAction members final
  Pass through script params in scripted metric agg (#29154)
  Remove silent batch mode from install plugin (#29359)
  Track Lucene operations in engine explicitly (#29357)
  Build: Fix Java9 MR build (#29312)
  Reindex: Fix error in delete-by-query rest spec (#29318)
  Move Nullable into core (#29341)
  [Docs] Correct experimental note formatting
  ...

@colings86 colings86 added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.