This feature allows to index points, circles and boxes in PREFIX_TREE mapping for ES.#294
Conversation
65fe639 to
6f76edd
Compare
sjudeng
left a comment
There was a problem hiding this comment.
Nice work. Can you also update documentation (e.g. elasticsearch.txt and searchpredicates.txt)?
|
|
||
| //Update some data | ||
| add(store, "doc4", getDocument("I'ts all a big Bob", -100, 11.2, Geoshape.point(48.0, 8.0), Geoshape.line(Arrays.asList(new double[][] {{7.5, 47.5}, {8.5, 48.5}})), Arrays.asList("10", "11", "12"), Sets.newHashSet("10", "11"), Instant.ofEpochSecond(4)), true); | ||
| add(store, "doc4", getDocument("I'ts all a big Bob", -100, 11.2, Geoshape.point(-48.0, 8.0), Geoshape.point(-48.0, 8.0), Arrays.asList("10", "11", "12"), Sets.newHashSet("10", "11"), Instant.ofEpochSecond(4)), true); |
There was a problem hiding this comment.
Is there a reason you changed the sign on the first point latitude?
There was a problem hiding this comment.
Yes, I want to test the reindexing process for prefix_tree in "doc1" so I change the sign on latitude to be sure that the document has really changed.
I do not want to change all tests thoroughly so I change also the sign en "doc4".
6f76edd to
504f773
Compare
| [[geoshape]] | ||
| === Geoshape Data Type | ||
| The Geoshape data type supports representing a point, circle, box, line, polygon, multi-point, multi-line and multi-polygon. Index backends currently support indexing points, lines and polygons. Indexing multi-point, multi-line and multi-polygon properties has not been tested. | ||
| The Geoshape data type supports representing a point, circle, box, line, polygon, multi-point, multi-line and multi-polygon. Index backends currently support indexing points, circles, boxes, lines and polygons. Indexing multi-point, multi-line and multi-polygon properties has not been tested. |
There was a problem hiding this comment.
Can you add language to make clear that indexing circles and boxes is only supported under Elasticsearch?
There was a problem hiding this comment.
Why only on Elasticsearch ?
Solr is also tested. And I think that the code allow it. https://github.com/JanusGraph/janusgraph/blob/master/janusgraph-solr/src/main/java/org/janusgraph/diskstorage/solr/SolrIndex.java#L361
There was a problem hiding this comment.
Right, perfect! That code was added in #79 I just hadn't tested circle/box indexing. Thanks!
| Geoshape.Point p = geoshape.getPoint(); | ||
| return new double[]{p.getLongitude(), p.getLatitude()}; | ||
| } else if (geoshape.getType() != Geoshape.Type.BOX && geoshape.getType() != Geoshape.Type.CIRCLE) { | ||
| } else if (geoshape.getType() == Geoshape.Type.BOX) { |
There was a problem hiding this comment.
why is it OK not to catch IOException for BOX but required for CIRCLE?
There was a problem hiding this comment.
Yes it's OK.
IOException is throwed by geoshape.toMap()
For Box, the map is constructed without using geoshape.toMap().
For Circle, the map is constructed with geoshape.toMap().
| case SET: | ||
| case LIST: | ||
| script.append("ctx._source[\"" + e.field + "\"].add(" + convertToJsType(e.value, scriptLang) + ");"); | ||
| script.append("ctx._source[\"" + e.field + "\"].add(" + convertToJsType(e.value, scriptLang, Mapping.getMapping(keyInformation)) + ");"); |
There was a problem hiding this comment.
use a String.format to reduce the number of frame switches
There was a problem hiding this comment.
@amcp Switching to String.format may be a performance hit. I was looking up whether it was preferred over StringBuilder and results seemed to say concatenation and StringBuilder end up being similar (though StringBuilder may be better style), but String.format is 5-20 time slower than both.
There was a problem hiding this comment.
@sjudeng Wow. Thank you for this important learning. StringBuilder is the way to go from now on.
| script.append("ctx._source[\"" + e.field + "\"].add(" + convertToJsType(e.value, scriptLang, Mapping.getMapping(keyInformation)) + ");"); | ||
| if (hasDualStringMapping(keyInformation)) { | ||
| script.append("ctx._source[\"" + getDualMappingName(e.field) + "\"].add(" + convertToJsType(e.value, scriptLang) + ");"); | ||
| script.append("ctx._source[\"" + getDualMappingName(e.field) + "\"].add(" + convertToJsType(e.value, scriptLang, Mapping.getMapping(keyInformation)) + ");"); |
Signed-off-by: David Clement <[email protected]>
504f773 to
d1a7e58
Compare
…ixPrefixTree This feature allows to index points, circles and boxes in PREFIX_TREE mapping for ES.
…ixPrefixTree This feature allows to index points, circles and boxes in PREFIX_TREE mapping for ES.
I also fix some indentation issue.
#293
Signed-off-by: David Clement [email protected]