|
5 | 5 | import com.spatial4j.core.distance.DistanceUnits;
|
6 | 6 | import org.apache.lucene.document.Field;
|
7 | 7 | import org.apache.lucene.document.Fieldable;
|
| 8 | +import org.apache.lucene.index.FieldInfo; |
| 9 | +import org.elasticsearch.ElasticSearchIllegalArgumentException; |
| 10 | +import org.elasticsearch.common.Strings; |
| 11 | +import org.elasticsearch.common.geo.GeoJSONShapeParser; |
8 | 12 | import org.elasticsearch.common.lucene.spatial.SpatialStrategy;
|
9 | 13 | import org.elasticsearch.common.lucene.spatial.prefix.TermQueryPrefixTreeStrategy;
|
10 | 14 | import org.elasticsearch.common.lucene.spatial.prefix.tree.GeohashPrefixTree;
|
11 | 15 | import org.elasticsearch.common.lucene.spatial.prefix.tree.QuadPrefixTree;
|
12 |
| -import org.elasticsearch.ElasticSearchIllegalArgumentException; |
13 |
| -import org.elasticsearch.common.Strings; |
14 |
| -import org.elasticsearch.common.geo.GeoJSONShapeParser; |
15 | 16 | import org.elasticsearch.common.lucene.spatial.prefix.tree.SpatialPrefixTree;
|
16 | 17 | import org.elasticsearch.common.xcontent.XContentBuilder;
|
17 | 18 | import org.elasticsearch.index.mapper.FieldMapper;
|
|
25 | 26 |
|
26 | 27 | /**
|
27 | 28 | * FieldMapper for indexing {@link com.spatial4j.core.shape.Shape}s.
|
28 |
| - * |
| 29 | + * <p/> |
29 | 30 | * Currently Shapes can only be indexed and can only be queried using
|
30 | 31 | * {@link org.elasticsearch.index.query.GeoShapeFilterParser}, consequently
|
31 | 32 | * a lot of behavior in this Mapper is disabled.
|
32 |
| - * |
| 33 | + * <p/> |
33 | 34 | * Format supported:
|
34 |
| - * |
| 35 | + * <p/> |
35 | 36 | * "field" : {
|
36 |
| - * "type" : "polygon", |
37 |
| - * "coordinates" : [ |
38 |
| - * [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] |
39 |
| - * ] |
| 37 | + * "type" : "polygon", |
| 38 | + * "coordinates" : [ |
| 39 | + * [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] |
| 40 | + * ] |
40 | 41 | * }
|
41 | 42 | */
|
42 | 43 | public class GeoShapeFieldMapper extends AbstractFieldMapper<String> {
|
@@ -128,7 +129,7 @@ public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext
|
128 | 129 | private final SpatialStrategy spatialStrategy;
|
129 | 130 |
|
130 | 131 | public GeoShapeFieldMapper(FieldMapper.Names names, SpatialPrefixTree prefixTree, double distanceErrorPct) {
|
131 |
| - super(names, Field.Index.NOT_ANALYZED, Field.Store.NO, Field.TermVector.NO, 1, true, true, null, null); |
| 132 | + super(names, Field.Index.NOT_ANALYZED, Field.Store.NO, Field.TermVector.NO, 1, true, FieldInfo.IndexOptions.DOCS_ONLY, null, null); |
132 | 133 | this.spatialStrategy = new TermQueryPrefixTreeStrategy(names, prefixTree, distanceErrorPct);
|
133 | 134 | }
|
134 | 135 |
|
|
0 commit comments