Skip to content

Conversation

@MaineC
Copy link

@MaineC MaineC commented Jul 16, 2015

This is pretty much work in progress (e.g. misses validation). It comes with two questions/issues I ran into and need help with/ feedback for:

  1. In order to make JSON (de-)serialization roundtrip I believe in QueryBuilder:doXContent I need to be able to generate JSON that can subsequently be parsed here:
    } else if ("normalize".equals(currentFieldName)) {
    - we seem to parse two consecutive boolean values stored as one value in a field. I didn't find a way of generating valid JSON that can be parsed by this line though.
  2. When checking the code for query generation I ran into the same issue as with Refactoring of GeoBoundingBoxQueryBuilder and -Parser #11969 - except this time (if I'm reading things correctly) we always need a valid indexService.

@MaineC
Copy link
Author

MaineC commented Jul 20, 2015

Wrt. to parsing consecutive boolean values out of json - this might become obsolete anyway as soon as #12300 is in.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe null-check here, otherwise we might get NPEs later.

@cbuescher
Copy link
Member

@MaineC did a first quick round of review. Not sure what to do regarding the question if we need a valid indexService. If this is related to the "optimizeBbox" option, I saw that theres also a "none" option in the resulting Lucene query, maybe that would help? Don't properly understand what that option does to be honest.
The other question regarding the "normalize" parameter seems to be solved or at least deprecated, right?

@MaineC
Copy link
Author

MaineC commented Jul 21, 2015

Thanks for your comments - will incorporate them into the PR tomorrow.

Not sure what to do regarding the question if we need a valid indexService. If this is related to the
"optimizeBbox" option,

... it is - but only partially: Even if setting this option to the value that worked for the GeoBoundingBoxQueryBuilder tests it's still impossible to run the doQuery method. The problem is in the following line:

https://github.com/elastic/elasticsearch/pull/12283/files#diff-07ff0f9821841e51d05e48d81d599582R230

which runs into an AssertionError:

java.lang.AssertionError
at __randomizedtesting.SeedInfo.seed([C187522A567CA44F:367C501427FF61A5]:0)
at org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache$IndexFieldCache.(IndicesFieldDataCache.java:155)
at org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache.buildIndexFieldDataCache(IndicesFieldDataCache.java:103)
at org.elasticsearch.index.fielddata.IndexFieldDataService.getForField(IndexFieldDataService.java:268)
at org.elasticsearch.index.query.QueryParseContext.getForField(QueryParseContext.java:181)
...

I've had the same issue with the GeoBoundingBoxQuery test, except that there was at least one code path that didn't run into the problem above. Maybe this is one of those queries that really need at least a single node pulled up to be tested?

The other question regarding the "normalize" parameter seems to be solved or at least deprecated,
right?

s/seems to be solved/will be solved as soon as the PR I reference above is in, so far it's still open, no?

Isabel Drost-Fromm added 3 commits September 9, 2015 21:38
This add equals, hashcode, read/write methods, validation, separates toQuery
and JSON parsing and adds serialization and query generation tests.

Deprecates two types of initializing the bounding box: In our documentation we
speak about specifying top/left and bottom/right corner of a bounding box. Here
we also allow for top/right and bottom/left. This adds not only to the amount
of code but also testing needed w/o too much benefit for the user other than
more chances to confuse top/right/bottom/left/latitude/longitude IMHO.

Missing: The toQuery method with type set to "indexed" is not tested at the
moment.

Cleanup changes unrelated to base refactoring:
* Switched from type String to enum for types in GeoBoundingBoxQueryBuilder.
* Switched to using type GeoPoint for storing the bounding box coordinates
  instead of array of double values.

Relates to elastic#10217 for the query refactoring part.
Relates to elastic#12016 for how missing mappings are handled.

Adds a utility class for generating random geo data.

Adds some missing documentation.

Extend test to MEMORY type config
Splits parsing and Lucene query generation. Switches from storing lat/lon
separately to using GeoPoint instead. Creates first test stub.

Relates to elastic#10217

Add serialisation and basic testing.

Adds test query generation, readFrom, writeTo, equals, hashCode.

Issues:

* testFromXContent fails as the current doXContent does not serialise
  normalizeLat/normalizeLon in a way fromXContent can parse correctly.
* testToQuery fails as query generation seems to rely on an actual
  node being pulled up (much like we already had in the GeoBoundingBox case,
  only that this time I see no code path that doesn't need the node)

Add basic validation
@MaineC MaineC force-pushed the feature/geo-distance-refactoring branch from efd4de1 to 9c6cc4a Compare September 10, 2015 18:57
@MaineC
Copy link
Author

MaineC commented Sep 10, 2015

Needs another rebase, also needs to have unit test fixed.

Caveat: As validation and some tests will rely on what was already done for GeoBoundingBox the latter changes were merged into the branch this PR is based on. This should be merged after the bounding box PR was merged.

@MaineC
Copy link
Author

MaineC commented Sep 10, 2015

Will be continued in a separate PR by @cbuescher

@MaineC MaineC closed this Sep 10, 2015
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Query Refactoring labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Search/Search Search-related issues that do not fall into other categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants