polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [07/50] [abbrv] zest-qi4j git commit: Updates, Cleanup and preparation for a pull request.
Date Fri, 17 Apr 2015 16:45:54 GMT
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/functions/predicates/ST_Within.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/functions/predicates/ST_Within.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/functions/predicates/ST_Within.java
index 5b378c3..d00bd2e 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/functions/predicates/ST_Within.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/functions/predicates/ST_Within.java
@@ -1,33 +1,43 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
 package org.qi4j.index.elasticsearch.extensions.spatial.functions.predicates;
 
-import com.spatial4j.core.distance.DistanceUtils;
 import org.elasticsearch.common.geo.ShapeRelation;
 import org.elasticsearch.index.query.FilterBuilder;
 import org.elasticsearch.index.query.FilterBuilders;
 import org.elasticsearch.index.query.GeoPolygonFilterBuilder;
 import org.qi4j.api.geometry.TPoint;
 import org.qi4j.api.geometry.TPolygon;
-import org.qi4j.api.geometry.internal.TCircle;
 import org.qi4j.api.geometry.internal.TGeometry;
-import org.qi4j.api.query.grammar.extensions.spatial.predicate.ST_DisjointSpecification;
 import org.qi4j.api.query.grammar.extensions.spatial.predicate.ST_WithinSpecification;
 import org.qi4j.api.query.grammar.extensions.spatial.predicate.SpatialPredicatesSpecification;
+import org.qi4j.api.structure.Module;
+import org.qi4j.index.elasticsearch.ElasticSearchSupport;
 import org.qi4j.index.elasticsearch.extensions.spatial.internal.AbstractElasticSearchSpatialFunction;
 import org.qi4j.spi.query.EntityFinderException;
 
 import java.util.Map;
 
 
-
-public class ST_Within extends AbstractElasticSearchSpatialFunction implements PredicateFinderSupport.PredicateSpecification
-{
+public class ST_Within extends AbstractElasticSearchSpatialFunction implements PredicateFinderSupport.PredicateSpecification {
 
 
     public void processSpecification(FilterBuilder filterBuilder,
                                      SpatialPredicatesSpecification<?> spec,
                                      Map<String, Object> variables)
-            throws EntityFinderException
-    {
+            throws EntityFinderException {
         TGeometry geomOfFilterProperty = resolveGeometry(filterBuilder, spec, module);
 
         if (!isValid(spec))
@@ -39,8 +49,6 @@ public class ST_Within extends AbstractElasticSearchSpatialFunction implements P
         if (!isSupported(spec, geomOfFilterProperty))
             throw new EntityFinderException(spec.getClass() + " expression unsupported by ElasticSearch. Pls specify a supported expression.");
 
-        System.out.println("Ismapped As Piont " +isMappedAsGeoPoint(spec.property()));
-        System.out.println("Ismapped As Shape " + isMappedAsGeoShape(spec.property()));
 
         /**
          * When the geometry used in the ST_Within expression is of type TPoint and a distance is specified, e.g.
@@ -53,10 +61,9 @@ public class ST_Within extends AbstractElasticSearchSpatialFunction implements P
          */
         if (
                 isTPoint(geomOfFilterProperty) &&
-                isMappedAsGeoPoint(spec.property()) &&
-                ((ST_WithinSpecification) spec).getDistance() > 0
-           )
-        {
+                        isMappedAsGeoPoint(spec.property()) &&
+                        ((ST_WithinSpecification) spec).getDistance() > 0
+                ) {
             addFilter(createGeoDistanceFilter
                             (
                                     spec.property().toString(),
@@ -75,14 +82,11 @@ public class ST_Within extends AbstractElasticSearchSpatialFunction implements P
          * ST_Within (templafeFor(x.class).propertyOfTypeTPoint(), polygon);
          *
          */
-        else if (isPropertyOfType(TPoint.class, spec.property()))
-        {
+        else if (isPropertyOfType(TPoint.class, spec.property())) {
 
-            if (isMappedAsGeoPoint(spec.property()))
-            {
+            if (isMappedAsGeoPoint(spec.property())) {
 
-                if (geomOfFilterProperty instanceof TPolygon)
-                {
+                if (geomOfFilterProperty instanceof TPolygon) {
                     /**
                      * This must not happen, but in case the expression is defined using WTK like :
                      *
@@ -101,8 +105,7 @@ public class ST_Within extends AbstractElasticSearchSpatialFunction implements P
 
                     GeoPolygonFilterBuilder geoPolygonFilterBuilder = FilterBuilders.geoPolygonFilter(spec.property().toString());
 
-                    for (int i = 0; i < polygonFilter.shell().get().getNumPoints(); i++)
-                    {
+                    for (int i = 0; i < polygonFilter.shell().get().getNumPoints(); i++) {
                         TPoint point = polygonFilter.shell().get().getPointN(i);
                         geoPolygonFilterBuilder.addPoint(point.y(), point.x());
                     }
@@ -111,32 +114,28 @@ public class ST_Within extends AbstractElasticSearchSpatialFunction implements P
                     throw new EntityFinderException("Invalid ST_Within expression. Unsupported type " + geomOfFilterProperty.getClass().getSimpleName() +
                             " On properties of type " + TPoint.class.getSimpleName() +
                             " only filters of type distance or polygon are supported.");
-            }
-            else if (isMappedAsGeoShape(spec.property()) )
-            {
-                if (geomOfFilterProperty instanceof TPolygon)
-                {
+            } else if (isMappedAsGeoShape(spec.property())) {
+                if (geomOfFilterProperty instanceof TPolygon) {
                     addFilter(createShapeFilter(spec.property().toString(), geomOfFilterProperty, ShapeRelation.WITHIN), filterBuilder);
-                }
-
-                else if (((ST_WithinSpecification) spec).getDistance() > 0) {
-                    double distanceMeters = convertDistanceToMeters(((ST_WithinSpecification) spec).getDistance(), ((ST_WithinSpecification) spec).getUnit());
-                    System.out.println("Distance in Meters " + distanceMeters);
-                    double distanceDegrees = DistanceUtils.dist2Degrees(distanceMeters, DistanceUtils.EARTH_MEAN_RADIUS_KM * 1000);
-                    // This is a special case. We are using polygon substitution to support a circle. ATTENTION - this is just a approximation !!
-                    TPoint circlePoint = (TPoint)verifyProjection(geomOfFilterProperty);
-                    TCircle tCircle = module.newValueBuilder(TCircle.class).prototype().of(circlePoint, distanceDegrees);
-                    TPolygon polygonizedCircleFilter = tCircle.polygonize(360);
+                } else if (((ST_WithinSpecification) spec).getDistance() > 0) {
+                    double radiusInMeters = convertDistanceToMeters(((ST_WithinSpecification) spec).getDistance(), ((ST_WithinSpecification) spec).getUnit());
+                    TPolygon polygonizedCircleFilter = polygonizeCircle((TPoint) verifyProjection(geomOfFilterProperty), radiusInMeters);
                     addFilter(createShapeFilter(spec.property().toString(), polygonizedCircleFilter, ShapeRelation.WITHIN), filterBuilder);
                 }
             }
-        }
-        else
-        {
-            /**
-             * In all other cases we are using a shape filter.
-             */
+        } else {
+
             addFilter(createShapeFilter(spec.property().toString(), geomOfFilterProperty, ShapeRelation.WITHIN), filterBuilder);
         }
     }
+
+
+    public PredicateFinderSupport.PredicateSpecification support(Module module, ElasticSearchSupport support) {
+        this.module = module;
+        this.support = support;
+
+        return this;
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/AbstractElasticSearchSpatialFinderSupport.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/AbstractElasticSearchSpatialFinderSupport.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/AbstractElasticSearchSpatialFinderSupport.java
deleted file mode 100644
index 321e73f..0000000
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/AbstractElasticSearchSpatialFinderSupport.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.qi4j.index.elasticsearch.extensions.spatial.internal;
-
-/**
- * Created by jj on 20.11.14.
- */
-public class AbstractElasticSearchSpatialFinderSupport {
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/AbstractElasticSearchSpatialFunction.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/AbstractElasticSearchSpatialFunction.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/AbstractElasticSearchSpatialFunction.java
index 68ad30b..523cac5 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/AbstractElasticSearchSpatialFunction.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/AbstractElasticSearchSpatialFunction.java
@@ -1,5 +1,20 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
 package org.qi4j.index.elasticsearch.extensions.spatial.internal;
 
+import com.spatial4j.core.distance.DistanceUtils;
 import org.elasticsearch.common.geo.ShapeRelation;
 import org.elasticsearch.common.geo.builders.CircleBuilder;
 import org.elasticsearch.common.geo.builders.PolygonBuilder;
@@ -10,6 +25,7 @@ import org.qi4j.api.composite.Composite;
 import org.qi4j.api.geometry.TPoint;
 import org.qi4j.api.geometry.TPolygon;
 import org.qi4j.api.geometry.TUnit;
+import org.qi4j.api.geometry.internal.TCircle;
 import org.qi4j.api.geometry.internal.TGeometry;
 import org.qi4j.api.property.GenericPropertyInfo;
 import org.qi4j.api.query.grammar.PropertyFunction;
@@ -29,9 +45,9 @@ import org.qi4j.spi.query.EntityFinderException;
 import java.lang.reflect.Type;
 import java.util.Map;
 
-import static org.qi4j.api.geometry.TGeometryFactory.*;
-import static org.qi4j.index.elasticsearch.extensions.spatial.mappings.SpatialIndexMapper.*;
-import static org.qi4j.library.spatial.v2.transformations.TTransformations.*;
+import static org.qi4j.api.geometry.TGeometryFactory.TPoint;
+import static org.qi4j.index.elasticsearch.extensions.spatial.mappings.SpatialIndexMapper.IndexMappingCache;
+import static org.qi4j.library.spatial.v2.transformations.TTransformations.Transform;
 
 
 /**
@@ -46,15 +62,7 @@ public abstract class AbstractElasticSearchSpatialFunction {
     protected Module module;
     protected ElasticSearchSupport support;
 
-    public void setModule(Module module, ElasticSearchSupport support)
-    {
-        this.module = module;
-        this.support = support;
-    }
-
-
-    protected boolean isSupported(SpatialPredicatesSpecification<?> spec, TGeometry geometryOfFilter) throws EntityFinderException
-    {
+    protected boolean isSupported(SpatialPredicatesSpecification<?> spec, TGeometry geometryOfFilter) throws EntityFinderException {
         return SpatialFunctionsSupportMatrix.isSupported
                 (
                         spec.getClass(),
@@ -62,70 +70,55 @@ public abstract class AbstractElasticSearchSpatialFunction {
                         InternalUtils.classOfGeometry(geometryOfFilter),
                         isMappedAsGeoPoint(spec.property()) ? SpatialConfiguration.INDEXING_METHOD.GEO_POINT : SpatialConfiguration.INDEXING_METHOD.GEO_SHAPE
                 );
-
     }
 
-    protected boolean isValid(SpatialPredicatesSpecification<?> spec) throws EntityFinderException
-    {
-        if ((spec.value() == null && spec.operator() == null))
+    protected boolean isValid(SpatialPredicatesSpecification<?> spec) throws EntityFinderException {
+        if ((spec.param() == null && spec.operator() == null))
             return false;
         else
             return true;
-
     }
 
 
-    protected void addFilter( FilterBuilder filter, FilterBuilder into )
-    {
-        if ( into instanceof AndFilterBuilder) {
-            ( (AndFilterBuilder) into ).add( filter );
-        } else if ( into instanceof OrFilterBuilder) {
-            ( (OrFilterBuilder) into ).add( filter );
+    protected void addFilter(FilterBuilder filter, FilterBuilder into) {
+        if (into instanceof AndFilterBuilder) {
+            ((AndFilterBuilder) into).add(filter);
+        } else if (into instanceof OrFilterBuilder) {
+            ((OrFilterBuilder) into).add(filter);
         } else {
-            throw new UnsupportedOperationException( "FilterBuilder is nor an AndFB nor an OrFB, cannot continue." );
+            throw new UnsupportedOperationException("FilterBuilder is nor an AndFB nor an OrFB, cannot continue.");
         }
     }
 
-    protected TGeometry verifyProjection(TGeometry tGeometry)
-    {
+    protected TGeometry verifyProjection(TGeometry tGeometry) {
         if (new ProjectionsRegistry().getCRS(tGeometry.getCRS()) == null)
-            throw new RuntimeException("Project with the CRS Identity " + tGeometry.getCRS() + " is unknown. Supported projections are JJ TODO" );
+            throw new RuntimeException("Project with the CRS Identity " + tGeometry.getCRS() + " is unknown. Supported projections are JJ TODO");
 
 
         try {
             if (!tGeometry.getCRS().equalsIgnoreCase(DefaultSupportedProjection)) {
-                if (SpatialConfiguration.isFinderProjectionConversionEnabled(support.spatialConfiguration()))
-                {
+                if (SpatialConfiguration.isFinderProjectionConversionEnabled(support.spatialConfiguration())) {
                     Transform(module).from(tGeometry).to(DefaultSupportedProjection, DefaultProjectionConversionPrecisionInMeters);
-                }  else throw new Exception("Filter Projection has a unsupported Projection and conversion is disabled");
+                } else throw new Exception("Filter Projection has a unsupported Projection and conversion is disabled");
             }
-        } catch (Exception _ex)
-        {
+        } catch (Exception _ex) {
             _ex.printStackTrace();
         }
 
         return tGeometry; // ATTENTION - we are transforming as per "Reference"
     }
 
-    protected boolean isPropertyOfType(Class type, PropertyFunction propertyFunction)
-    {
+    protected boolean isPropertyOfType(Class type, PropertyFunction propertyFunction) {
         Type returnType = Classes.typeOf(propertyFunction.accessor());
         Type propertyTypeAsType = GenericPropertyInfo.toPropertyType(returnType);
 
-
-
-        System.out.println("---- > " + propertyTypeAsType.getTypeName());
-
         Class clazz;
 
-        try
-        {
+        try {
             clazz = Class.forName(propertyTypeAsType.getTypeName());
-        } catch(Exception _ex)
-        {
+        } catch (Exception _ex) {
             throw new RuntimeException(_ex);
         }
-        // if (clazz instanceof TGeometry)
 
         if (type.isAssignableFrom(clazz))
             return true;
@@ -133,8 +126,7 @@ public abstract class AbstractElasticSearchSpatialFunction {
             return false;
     }
 
-    protected boolean isPropertyOfTypeTPoint(PropertyFunction propertyFunction)
-    {
+    protected boolean isPropertyOfTypeTPoint(PropertyFunction propertyFunction) {
         // String typeName = Classes.typeOf(propertyFunction.accessor()).getTypeName();
         // System.out.println(typeName);
 
@@ -146,11 +138,9 @@ public abstract class AbstractElasticSearchSpatialFunction {
 
         Class clazz;
 
-        try
-        {
+        try {
             clazz = Class.forName(propertyTypeAsType.getTypeName());
-        } catch(Exception _ex)
-        {
+        } catch (Exception _ex) {
             throw new RuntimeException(_ex);
         }
         // if (clazz instanceof TGeometry)
@@ -161,90 +151,88 @@ public abstract class AbstractElasticSearchSpatialFunction {
             return false;
     }
 
-    protected boolean isMappedAsGeoPoint(PropertyFunction property)
-    {
+    protected boolean isMappedAsGeoPoint(PropertyFunction property) {
         return IndexMappingCache.isMappedAsGeoPoint(support.index(), support.entitiesType(), property.toString());
     }
 
 
-
-    protected boolean isTPoint(TGeometry filterGeometry)
-    {
+    protected boolean isTPoint(TGeometry filterGeometry) {
         return TPoint(module).isPoint(filterGeometry);
     }
 
-    protected boolean isMappedAsGeoShape(PropertyFunction property)
-    {
+    protected boolean isMappedAsGeoShape(PropertyFunction property) {
         return IndexMappingCache.isMappedAsGeoShape(support.index(), support.entitiesType(), property.toString());
     }
 
-    protected boolean isMapped(PropertyFunction property)
-    {
+    protected boolean isMapped(PropertyFunction property) {
         return IndexMappingCache.mappingExists(support.index(), support.entitiesType(), property.toString());
     }
 
-    protected boolean isSpatial(PropertyFunction property)
-    {
+    protected boolean isSpatial(PropertyFunction property) {
         return false;
     }
 
 
-
-    protected GeoShapeFilterBuilder createShapeFilter(String name, TPoint point, ShapeRelation relation, double distance, TUnit unit)
-    {
+    protected GeoShapeFilterBuilder createShapeFilter(String name, TPoint point, ShapeRelation relation, double distance, TUnit unit) {
         return createShapeFilter(name, point, relation, distance, convertDistanceUnit(unit));
     }
 
-    protected GeoShapeFilterBuilder createShapeFilter(String name, TGeometry geometry, ShapeRelation relation)
-    {
+    protected GeoShapeFilterBuilder createShapeFilter(String name, TGeometry geometry, ShapeRelation relation) {
         return createShapeFilter(name, geometry, relation, 0, null);
     }
 
-    protected GeoDistanceFilterBuilder createGeoDistanceFilter(String name, TPoint tPoint, double distance, TUnit unit)
-    {
+    protected GeoDistanceFilterBuilder createGeoDistanceFilter(String name, TPoint tPoint, double distance, TUnit unit) {
         // Lat = Y Long = X
-      return  FilterBuilders.geoDistanceFilter(name)
-              .lat(tPoint.y())
-              .lon(tPoint.x())
-              .distance(distance, convertDistanceUnit(unit));
+        return FilterBuilders.geoDistanceFilter(name)
+                .lat(tPoint.y())
+                .lon(tPoint.x())
+                .distance(distance, convertDistanceUnit(unit));
+    }
+
+    protected TPolygon polygonizeCircle(TPoint centre, double radiusInMeters) {
+        double radiusInDegrees = DistanceUtils.dist2Degrees(radiusInMeters, DistanceUtils.EARTH_MEAN_RADIUS_KM * 1000);
+        TCircle tCircle = module.newValueBuilder(TCircle.class).prototype().of(centre, radiusInDegrees);
+        return tCircle.polygonize(360);
     }
 
 
-    private DistanceUnit convertDistanceUnit(TUnit tUnit)
-    {
-        switch (tUnit)
-        {
-            case MILLIMETER : return DistanceUnit.MILLIMETERS;
-            case CENTIMETER : return DistanceUnit.CENTIMETERS;
-            case METER      : return DistanceUnit.METERS;
-            case KILOMETER  :return DistanceUnit.KILOMETERS;
-            default : throw new RuntimeException("Can not convert Units");
+    private DistanceUnit convertDistanceUnit(TUnit tUnit) {
+        switch (tUnit) {
+            case MILLIMETER:
+                return DistanceUnit.MILLIMETERS;
+            case CENTIMETER:
+                return DistanceUnit.CENTIMETERS;
+            case METER:
+                return DistanceUnit.METERS;
+            case KILOMETER:
+                return DistanceUnit.KILOMETERS;
+            default:
+                throw new RuntimeException("Can not convert Units");
         }
     }
 
-    protected double convertDistanceToMeters(double source, TUnit sourceUnit)
-    {
-        switch (sourceUnit)
-        {
-            case MILLIMETER : return source / 1000;
-            case CENTIMETER : return source / 100;
-            case METER      : return source;
-            case KILOMETER  : return source * 1000;
-            default : throw new RuntimeException("Can not convert Units");
+    protected double convertDistanceToMeters(double source, TUnit sourceUnit) {
+        switch (sourceUnit) {
+            case MILLIMETER:
+                return source / 1000;
+            case CENTIMETER:
+                return source / 100;
+            case METER:
+                return source;
+            case KILOMETER:
+                return source * 1000;
+            default:
+                throw new RuntimeException("Can not convert Units");
         }
     }
 
 
-    private GeoShapeFilterBuilder createShapeFilter(String name, TGeometry geometry, ShapeRelation relation, double distance, DistanceUnit unit  )
-    {
-        if (geometry instanceof TPoint)
-        {
+    private GeoShapeFilterBuilder createShapeFilter(String name, TGeometry geometry, ShapeRelation relation, double distance, DistanceUnit unit) {
+        if (geometry instanceof TPoint) {
             CircleBuilder circleBuilder = ShapeBuilder.newCircleBuilder();
-            circleBuilder.center(((TPoint) geometry).x(), ((TPoint)geometry).y()).radius(distance, unit);
+            circleBuilder.center(((TPoint) geometry).x(), ((TPoint) geometry).y()).radius(distance, unit);
             return FilterBuilders.geoShapeFilter(name, circleBuilder, relation);
-        }
-        else if (geometry instanceof TPolygon)
-        {
+        } else if (geometry instanceof TPolygon) {
             PolygonBuilder polygonBuilder = ShapeBuilder.newPolygon();
 
             for (int i = 0; i < ((TPolygon) geometry).shell().get().points().get().size(); i++) {
@@ -256,10 +244,8 @@ public abstract class AbstractElasticSearchSpatialFunction {
                 );
             }
 
-            return  FilterBuilders.geoShapeFilter(name, polygonBuilder, relation);
-        }
-        else
-        {
+            return FilterBuilders.geoShapeFilter(name, polygonBuilder, relation);
+        } else {
 
         }
 
@@ -267,21 +253,15 @@ public abstract class AbstractElasticSearchSpatialFunction {
     }
 
 
-    protected TGeometry resolveGeometry( FilterBuilder filterBuilder, Specification<Composite> spec, Module module) throws  EntityFinderException
-    {
+    protected TGeometry resolveGeometry(FilterBuilder filterBuilder, Specification<Composite> spec, Module module) throws EntityFinderException {
 
-        if (spec instanceof SpatialPredicatesSpecification)
-        {
-            if (((SpatialPredicatesSpecification)spec).value() != null)
-            {
-                return ((SpatialPredicatesSpecification)spec).value();
-            }
-            else if (((SpatialPredicatesSpecification)spec).operator() != null)
-            {
+        if (spec instanceof SpatialPredicatesSpecification) {
+            if (((SpatialPredicatesSpecification) spec).param() != null) {
+                return ((SpatialPredicatesSpecification) spec).param();
+            } else if (((SpatialPredicatesSpecification) spec).operator() != null) {
 
-                if (((SpatialPredicatesSpecification) spec).operator() instanceof SpatialConvertSpecification)
-                {
-                    executeSpecification(filterBuilder, (SpatialPredicatesSpecification)spec, null);
+                if (((SpatialPredicatesSpecification) spec).operator() instanceof SpatialConvertSpecification) {
+                    executeSpecification(filterBuilder, (SpatialPredicatesSpecification) spec, null);
                     System.out.println("Converted Geometry " + ((SpatialConvertSpecification) ((SpatialPredicatesSpecification) spec).operator()).getGeometry());
                     return ((SpatialConvertSpecification) ((SpatialPredicatesSpecification) spec).operator()).getGeometry();
                     // return executeSpecification(filterBuilder, (SpatialPredicatesSpecification)spec, null);
@@ -294,22 +274,18 @@ public abstract class AbstractElasticSearchSpatialFunction {
         return null;
     }
 
-    private void executeSpecification( FilterBuilder filterBuilder,
-                                            SpatialPredicatesSpecification<?> spec,
-                                            Map<String, Object> variables ) throws EntityFinderException
-    {
+    private void executeSpecification(FilterBuilder filterBuilder,
+                                      SpatialPredicatesSpecification<?> spec,
+                                      Map<String, Object> variables) throws EntityFinderException {
 
 
         if (((SpatialPredicatesSpecification) spec).operator() instanceof SpatialConvertSpecification) {
-            // return ((SpatialConvertSpecification) ((SpatialPredicatesSpecification) spec).operator()).convert(module);
 
-            System.out.println("####### " + spec.operator().getClass().getSuperclass());
 
-            if (ElasticSearchFinder.Mixin.EXTENDED_QUERY_EXPRESSIONS_CATALOG.get(spec.operator().getClass().getSuperclass()) != null) {
+            if (ElasticSearchFinder.Mixin.EXTENDED_SPEC_SUPPORTS.get(spec.operator().getClass().getSuperclass()) != null) {
 
-                ElasticSearchSpatialFinder.SpatialQuerySpecSupport spatialQuerySpecSupport = ElasticSearchFinder.Mixin.EXTENDED_QUERY_EXPRESSIONS_CATALOG.get(spec.operator().getClass().getSuperclass());
-                spatialQuerySpecSupport.setModule(module, support);
-                // return spatialQuerySpecSupport.processSpecification(filterBuilder, spec.operator(), variables);
+                ElasticSearchSpatialFinder.SpatialQuerySpecSupport spatialQuerySpecSupport = ElasticSearchFinder.Mixin.EXTENDED_SPEC_SUPPORTS
+                        .get(spec.operator().getClass().getSuperclass()).support(module, support);
                 spatialQuerySpecSupport.processSpecification(filterBuilder, spec.operator(), variables);
 
             } else {
@@ -321,5 +297,4 @@ public abstract class AbstractElasticSearchSpatialFunction {
     }
 
 
-
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/InternalUtils.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/InternalUtils.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/InternalUtils.java
index 1ce6a4e..f7ed650 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/InternalUtils.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/internal/InternalUtils.java
@@ -1,10 +1,23 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
 package org.qi4j.index.elasticsearch.extensions.spatial.internal;
 
 import org.qi4j.api.geometry.*;
 import org.qi4j.api.geometry.internal.TGeometry;
 import org.qi4j.api.property.GenericPropertyInfo;
 import org.qi4j.api.query.grammar.PropertyFunction;
-import org.qi4j.api.query.grammar.extensions.spatial.predicate.SpatialPredicatesSpecification;
 import org.qi4j.api.util.Classes;
 
 import java.lang.reflect.Type;
@@ -12,36 +25,29 @@ import java.lang.reflect.Type;
 /**
  * Ugly - not proud on this... How to make it better ?
  */
-public class InternalUtils
-{
+public class InternalUtils {
 
-    public static Class classOfPropertyType(PropertyFunction propertyFunction)
-    {
+    public static Class classOfPropertyType(PropertyFunction propertyFunction) {
         Type typeOfProperty = GenericPropertyInfo.toPropertyType(Classes.typeOf(propertyFunction.accessor()));
         Class classOfProperty = null;
-        try
-        {
+        try {
             classOfProperty = Class.forName(typeOfProperty.getTypeName());
-        } catch(Exception _ex)
-        {
+        } catch (Exception _ex) {
             // must not happen
             // TODO, logger
-        }
-        finally
-        {
+        } finally {
             return classOfProperty;
         }
     }
 
-    public static Class<? extends TGeometry> classOfGeometry(TGeometry geometry)
-    {
-        if (geometry instanceof TPoint)                 return TPoint.class;
-        if (geometry instanceof TMultiPoint)            return TMultiPoint.class;
-        if (geometry instanceof TLineString)            return TLineString.class;
-        if (geometry instanceof TPolygon)               return TPolygon.class;
-        if (geometry instanceof TMultiPolygon)          return TMultiPolygon.class;
-        if (geometry instanceof TFeature)               return TFeature.class;
-        if (geometry instanceof TFeatureCollection)     return TFeatureCollection.class;
+    public static Class<? extends TGeometry> classOfGeometry(TGeometry geometry) {
+        if (geometry instanceof TPoint) return TPoint.class;
+        if (geometry instanceof TMultiPoint) return TMultiPoint.class;
+        if (geometry instanceof TLineString) return TLineString.class;
+        if (geometry instanceof TPolygon) return TPolygon.class;
+        if (geometry instanceof TMultiPolygon) return TMultiPolygon.class;
+        if (geometry instanceof TFeature) return TFeature.class;
+        if (geometry instanceof TFeatureCollection) return TFeatureCollection.class;
         else return null;
     }
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/SpatialIndexMapper.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/SpatialIndexMapper.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/SpatialIndexMapper.java
index 341b977..c1de598 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/SpatialIndexMapper.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/SpatialIndexMapper.java
@@ -1,50 +1,56 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
 package org.qi4j.index.elasticsearch.extensions.spatial.mappings;
 
 import org.qi4j.api.geometry.internal.TGeometry;
 import org.qi4j.index.elasticsearch.ElasticSearchSupport;
 import org.qi4j.index.elasticsearch.extensions.spatial.configuration.SpatialConfiguration;
 import org.qi4j.index.elasticsearch.extensions.spatial.mappings.cache.MappingsCachesTable;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import static org.qi4j.index.elasticsearch.extensions.spatial.mappings.builders.SpatialMappingFactory.*;
-import static org.qi4j.api.geometry.TGeometryFactory.*;
 
+import static org.qi4j.api.geometry.TGeometryFactory.TPoint;
+import static org.qi4j.index.elasticsearch.extensions.spatial.mappings.builders.SpatialMappingFactory.*;
 
-/**
- * Created by jj on 19.12.14.
- */
 public class SpatialIndexMapper {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(SpatialIndexMapper.class);
 
 
-    public static void createIfNotExist(ElasticSearchSupport support, TGeometry geometry, String property)
-    {
-        if (!MappingsCachesTable.getMappingCache(support).exists(property))
-        {
+    public static void createIfNotExist(ElasticSearchSupport support, TGeometry geometry, String property) {
+        if (!MappingsCachesTable.getMappingCache(support).exists(property)) {
             String mappingsOnServer = MappingQuery(support).get(property);
             System.out.println("Found " + mappingsOnServer);
 
-            if (mappingsOnServer != null)
-            {
+            if (mappingsOnServer != null) {
                 // TODO JJ check mappings : configuration versus server-side settings
                 MappingsCachesTable.getMappingCache(support).put(property, mappingsOnServer);
-            }
-            else
-            {
-                if (TPoint(support.getModule()).isPoint(geometry) )
-                {
-                    switch(SpatialConfiguration.getMethod(support.spatialConfiguration()) )
-                    {
-                        case GEO_POINT: GeoPointMapping(support).create(property); break;
-                        case GEO_SHAPE: GeoShapeMapping(support).create(property); break;
-                        default            : throw new RuntimeException("Unknown Point Maping Type.");
-                    }
-                }
-                else
-                {
+            } else {
+                if (TPoint(support.getModule()).isPoint(geometry)) {
+                    switch (SpatialConfiguration.getMethod(support.spatialConfiguration())) {
+                        case GEO_POINT:
+                            GeoPointMapping(support).create(property);
+                            break;
+                        case GEO_SHAPE:
                             GeoShapeMapping(support).create(property);
+                            break;
+                        default:
+                            throw new RuntimeException("Unknown Point Maping Type.");
+                    }
+                } else {
+                    GeoShapeMapping(support).create(property);
                 }
             }
         }
@@ -61,16 +67,12 @@ public class SpatialIndexMapper {
         public static boolean isMappedAsGeoShape(String index, String type, String property) {
             if (!MappingsCachesTable.getMappingCache(index, type).exists(property)) // <- No mappings yet, as no data in the index ?
                 return false;
-
-            // System.out.println("GEOSHAPE " + MappingsCachesTable.getMappingCache(index, type).get(property).toString());
             return MappingsCachesTable.getMappingCache(index, type).get(property).toString().indexOf("type=geo_shape") > -1 ? true : false;
         }
 
         public static boolean isMappedAsGeoPoint(String index, String type, String property) {
             if (!MappingsCachesTable.getMappingCache(index, type).exists(property)) // <- No mappings yet, as no data in the index ?
                 return false;
-
-            // System.out.println("GEOPOINT " +  MappingsCachesTable.getMappingCache(index, type).get(property).toString());
             return MappingsCachesTable.getMappingCache(index, type).get(property).toString().indexOf("type=geo_point") > -1 ? true : false;
         }
 
@@ -78,8 +80,7 @@ public class SpatialIndexMapper {
             return MappingsCachesTable.getMappingCache(index, type).exists(property);
         }
 
-        public static void clear()
-        {
+        public static void clear() {
             MappingsCachesTable.clear();
         }
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/AbstractBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/AbstractBuilder.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/AbstractBuilder.java
index 2d22b41..882c42c 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/AbstractBuilder.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/AbstractBuilder.java
@@ -1,3 +1,16 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 package org.qi4j.index.elasticsearch.extensions.spatial.mappings.builders;
 
 import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse;
@@ -9,13 +22,14 @@ import org.qi4j.index.elasticsearch.extensions.spatial.mappings.cache.MappingsCa
  * Created by jj on 19.12.14.
  */
 public class AbstractBuilder {
+
     protected ElasticSearchSupport support;
 
-    public String get(String field)
-    {
-        if ( !isValid() ) throw new RuntimeException("ElasticSearch Index or Type not defined");
+    public String get(String field) {
+        if (!isValid()) throw new RuntimeException("ElasticSearch Index or Type not defined");
 
-        String index = support.index(); String type = support.entitiesType();
+        String index = support.index();
+        String type = support.entitiesType();
 
         GetFieldMappingsResponse response = support.client().admin().indices()
                 .prepareGetFieldMappings(index)
@@ -33,25 +47,22 @@ public class AbstractBuilder {
     }
 
 
-
-    protected boolean isValid()
-    {
+    protected boolean isValid() {
         return (support != null) && (support.index() != null) && (support.entitiesType() != null) ? true : false;
     }
 
-    protected boolean put(String field, String mappingJson)
-    {
-        if ( !isValid() ) throw new RuntimeException("ElasticSearch Index or Type not defined");
+    protected boolean put(String field, String mappingJson) {
+        if (!isValid()) throw new RuntimeException("ElasticSearch Index or Type not defined");
 
-        String index = support.index(); String type = support.entitiesType();
+        String index = support.index();
+        String type = support.entitiesType();
 
         PutMappingResponse ESSpatialMappingPUTResponse = support.client().admin().indices()
                 .preparePutMapping(index).setType(type)
                 .setSource(mappingJson)
                 .execute().actionGet();
 
-        if (ESSpatialMappingPUTResponse.isAcknowledged())
-        {
+        if (ESSpatialMappingPUTResponse.isAcknowledged()) {
             // we are reading the mapping back from server to assure that the server-side mappings always "wins"
             MappingsCachesTable.getMappingCache(support.index(), support.entitiesType()).put(field, get(field));
             return true;

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/GeoPointBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/GeoPointBuilder.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/GeoPointBuilder.java
index 1bf89c6..c653283 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/GeoPointBuilder.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/GeoPointBuilder.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
 package org.qi4j.index.elasticsearch.extensions.spatial.mappings.builders;
 
 import org.elasticsearch.common.xcontent.XContentBuilder;
 import org.elasticsearch.common.xcontent.XContentFactory;
 import org.qi4j.index.elasticsearch.ElasticSearchSupport;
+import org.qi4j.index.elasticsearch.extensions.spatial.configuration.SpatialConfiguration;
 
 import java.io.IOException;
 import java.util.StringTokenizer;
@@ -12,57 +27,43 @@ import java.util.StringTokenizer;
  */
 public class GeoPointBuilder extends AbstractBuilder {
 
-    private static final String DEFAULT_PRECISION = "1m";
-
-
     public GeoPointBuilder(ElasticSearchSupport support) {
         this.support = support;
     }
 
-
-    public boolean create(String field) {
-        try {
-            return put(field, createGeoPointMapping(field));
-        } catch(Exception _ex)
-        {
-            _ex.printStackTrace();
-        }
-        return false;
-    }
-
-
-    private static String createGeoPointMapping(String field) throws IOException {
-
-
-        XContentBuilder qi4jRootType = XContentFactory.jsonBuilder().startObject().startObject("qi4j_entities");
-
-        StringTokenizer tokenizer1 = new StringTokenizer(field, ".");
+    private  String createGeoPointMapping(String field) throws IOException
+    {
+        XContentBuilder qi4jRootType = XContentFactory.jsonBuilder().startObject().startObject(support.entitiesType());
+        StringTokenizer t1 = new StringTokenizer(field, ".");
         String propertyLevel1;
-        while (tokenizer1.hasMoreTokens()) {
-            propertyLevel1 = tokenizer1.nextToken();
-            // System.out.println("--> start level " + propertyLevel1);
+        while (t1.hasMoreTokens())
+        {
+            propertyLevel1 = t1.nextToken();
             qi4jRootType.startObject("properties").startObject(propertyLevel1);
         }
+                qi4jRootType
+                        .field("type", "geo_point") // geo_point
+                        .field("precision", SpatialConfiguration.getIndexerPrecision(support.spatialConfiguration()))
+                        .field("lat_lon", true);
 
-        qi4jRootType.field("type", "geo_point") // geo_point
-                // .field("lat_lon", true)
-                // .field("geohash", DEFAULT_GEOHASH_SUPPORT)
-                .field("precision", DEFAULT_PRECISION)
-                .field("lat_lon", true);
-
-        StringTokenizer tokenizer2 = new StringTokenizer(field, ".");
-        String propertyLevel2;
-        while (tokenizer2.hasMoreTokens()) {
-            propertyLevel2 = tokenizer2.nextToken();
-
+        StringTokenizer t2 = new StringTokenizer(field, ".");
+        while (t2.hasMoreTokens())
+        {
+            t2.nextToken();
             qi4jRootType.endObject();
         }
 
         qi4jRootType.endObject().endObject().endObject();
-
-
         return qi4jRootType.string();
+    }
 
+    public boolean create(String field) {
+        try {
+            return put(field, createGeoPointMapping(field));
+        } catch (Exception _ex) {
+            _ex.printStackTrace();
+        }
+        return false;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/GeoShapeBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/GeoShapeBuilder.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/GeoShapeBuilder.java
index 058ad78..fb739fb 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/GeoShapeBuilder.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/GeoShapeBuilder.java
@@ -1,8 +1,23 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
 package org.qi4j.index.elasticsearch.extensions.spatial.mappings.builders;
 
 import org.elasticsearch.common.xcontent.XContentBuilder;
 import org.elasticsearch.common.xcontent.XContentFactory;
 import org.qi4j.index.elasticsearch.ElasticSearchSupport;
+import org.qi4j.index.elasticsearch.extensions.spatial.configuration.SpatialConfiguration;
 
 import java.io.IOException;
 import java.util.StringTokenizer;
@@ -12,82 +27,46 @@ import java.util.StringTokenizer;
  */
 public class GeoShapeBuilder extends AbstractBuilder {
 
-    private static final String DEFAULT_PRECISION = "1m";
-
-
     public GeoShapeBuilder(ElasticSearchSupport support) {
         this.support = support;
     }
 
-    public boolean create(String field) {
-        try {
-            return put(field, createESGeoShapeMapping(field));
-        } catch(Exception _ex)
-        {
-            _ex.printStackTrace();
-        }
-        return false;
-    }
-
-
-
-
-    private static String createESGeoShapeMapping(String property) throws IOException {
-
-        String valueType = "qi4j_entities"; // TODO JJ hack here
+    private  String createESGeoShapeMapping(String property) throws IOException {
 
-        // System.out.println("############## Property Tree" + property);
+        XContentBuilder qi4jRootType = XContentFactory.jsonBuilder().startObject().startObject(support.entitiesType());
 
-        XContentBuilder qi4jRootType = XContentFactory.jsonBuilder().startObject().startObject("qi4j_entities"); // .startObject("properties");
-
-        StringTokenizer tokenizer1 = new StringTokenizer(property, ".");
+        StringTokenizer t1 = new StringTokenizer(property, ".");
         String propertyLevel1;
-        while (tokenizer1.hasMoreTokens()) {
-            propertyLevel1 = tokenizer1.nextToken();
-            // System.out.println("--> start level " + propertyLevel1);
+        while (t1.hasMoreTokens())
+        {
+            propertyLevel1 = t1.nextToken();
             qi4jRootType.startObject("properties").startObject(propertyLevel1);
         }
 
+        qi4jRootType
+                .field("type", "geo_shape")
+                .field("precision", SpatialConfiguration.getIndexerPrecision(support.spatialConfiguration()))
+                .field("tree", "quadtree");
 
-        qi4jRootType.field("type", "geo_shape")
-                // .field("lat_lon", true)
-                // .field("geohash", DEFAULT_GEOHASH_SUPPORT)
-                .field("precision", DEFAULT_PRECISION)
-                .field("tree", "quadtree")
-                //.field("tree_levels",  "10");
-        ;
-        //.field("validate_lat", "true")
-        //.field("validate_lon", "true");
 
-        StringTokenizer tokenizer2 = new StringTokenizer(property, ".");
-        String propertyLevel2;
-        while (tokenizer2.hasMoreTokens()) {
-            propertyLevel2 = tokenizer2.nextToken();
-            // System.out.println("--> end level " + propertyLevel2);
-            // qi4jRootType.startObject(propertyLevel1);
+        StringTokenizer t2 = new StringTokenizer(property, ".");
+        while (t2.hasMoreTokens())
+        {
+            t2.nextToken();
             qi4jRootType.endObject();
         }
 
-/**
- return XContentFactory.jsonBuilder().startObject().startObject("qi4j_entities")// valueType)
- .startObject("properties").startObject(property)
- .field("type", "geo_point")
- .field("lat_lon", true)
- // .field("geohash", DEFAULT_GEOHASH_SUPPORT)
- .field("precision", DEFAULT_PRECISION)
- .field("validate_lat", "true")
- .field("validate_lon", "true")
- .endObject().endObject()
- .endObject().endObject().string();
- */
-
         qi4jRootType.endObject().endObject().endObject();
-
-        // System.out.println("qi4jRootType.toString() " + qi4jRootType.string());
-
         return qi4jRootType.string();
+    }
 
-
+    public boolean create(String field) {
+        try {
+            return put(field, createESGeoShapeMapping(field));
+        } catch (Exception _ex) {
+            _ex.printStackTrace();
+        }
+        return false;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/MappingQueryBuilder.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/MappingQueryBuilder.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/MappingQueryBuilder.java
index e027226..d70ae1c 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/MappingQueryBuilder.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/MappingQueryBuilder.java
@@ -1,3 +1,17 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
 package org.qi4j.index.elasticsearch.extensions.spatial.mappings.builders;
 
 import org.qi4j.index.elasticsearch.ElasticSearchSupport;

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/SpatialMappingFactory.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/SpatialMappingFactory.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/SpatialMappingFactory.java
index 30fb374..1d13756 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/SpatialMappingFactory.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/builders/SpatialMappingFactory.java
@@ -1,3 +1,17 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
 package org.qi4j.index.elasticsearch.extensions.spatial.mappings.builders;
 
 import org.qi4j.index.elasticsearch.ElasticSearchSupport;
@@ -10,13 +24,12 @@ public class SpatialMappingFactory {
     public static GeoPointBuilder GeoPointMapping(ElasticSearchSupport support) {
         return new GeoPointBuilder(support);
     }
-    public static GeoShapeBuilder GeoShapeMapping(ElasticSearchSupport support)
-    {
+
+    public static GeoShapeBuilder GeoShapeMapping(ElasticSearchSupport support) {
         return new GeoShapeBuilder(support);
     }
 
-    public static MappingQueryBuilder MappingQuery(ElasticSearchSupport support)
-    {
+    public static MappingQueryBuilder MappingQuery(ElasticSearchSupport support) {
         return new MappingQueryBuilder(support);
     }
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/cache/MappingsCache.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/cache/MappingsCache.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/cache/MappingsCache.java
index 9ab8278..3128092 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/cache/MappingsCache.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/cache/MappingsCache.java
@@ -1,3 +1,17 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
 package org.qi4j.index.elasticsearch.extensions.spatial.mappings.cache;
 
 import com.google.common.cache.CacheBuilder;
@@ -5,42 +19,45 @@ import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import org.qi4j.index.elasticsearch.ElasticSearchSupport;
 
-import static org.qi4j.index.elasticsearch.extensions.spatial.mappings.builders.SpatialMappingFactory.MappingQuery;
-
 import java.util.concurrent.TimeUnit;
 
+import static org.qi4j.index.elasticsearch.extensions.spatial.mappings.builders.SpatialMappingFactory.MappingQuery;
+
 /**
  * Created by jj on 19.12.14.
  */
 public class MappingsCache {
 
-    // private static final int TTL_SECONDS        = 10 * 60;
-    private static final int TTL_SECONDS        = 1;
-    private static final int CONCURENCY_LEVEL   = 50;
+    private static final int TTL_SECONDS = 1 * 60; // <- JJ TODO make it configurable
+    private static final int CONCURENCY_LEVEL = 50;
 
-    private  LoadingCache<String, String> ES_MAPPINGS_CACHE;
+    private LoadingCache<String, String> ES_MAPPINGS_CACHE;
 
     private ElasticSearchSupport support;
 
-      {
-
-            ES_MAPPINGS_CACHE =
-                    CacheBuilder.newBuilder()
-                            .expireAfterAccess(TTL_SECONDS, TimeUnit.SECONDS)
-                            .concurrencyLevel(CONCURENCY_LEVEL) // valid ?
-                            .build(
-                                    new CacheLoader<String, String>() {
-                                        public String load(String key) {
-                                            if (valid()) {
-                                                return reloadStrategy(key);
-                                            } else
-                                                return "";
-                                        }
+    {
+
+        ES_MAPPINGS_CACHE =
+                CacheBuilder.newBuilder()
+                        .expireAfterAccess(TTL_SECONDS, TimeUnit.SECONDS)
+                        .concurrencyLevel(CONCURENCY_LEVEL) // valid ?
+                        .build(
+                                new CacheLoader<String, String>() {
+                                    public String load(String key) {
+                                        if (valid()) {
+                                            return reloadStrategy(key);
+                                        } else
+                                            return "";
                                     }
-                            );
+                                }
+                        );
+
+    }
 
-        }
 
+    public MappingsCache(ElasticSearchSupport support) {
+        this.support = support;
+    }
 
     private String reloadStrategy(String key) {
 
@@ -51,41 +68,27 @@ public class MappingsCache {
         return (result == null || result.length() == 0) ? "" : result;
     }
 
-    private  boolean valid()
-    {
+    private boolean valid() {
         return (support != null) && (support.index() != null) && (support.entitiesType() != null) ? true : false;
     }
 
 
-    public MappingsCache(ElasticSearchSupport support)
-    {
-        this.support = support;
-    }
-
-
-
-
-
-
-    public  boolean exists(String key)
-    {
+    public boolean exists(String key) {
         return (ES_MAPPINGS_CACHE.getUnchecked(key) == null) || ES_MAPPINGS_CACHE.getUnchecked(key).length() == 0 ? false : true;
     }
 
-    public  String get(String key)
-    {
+    public String get(String key) {
         return ES_MAPPINGS_CACHE.getUnchecked(key);
     }
 
 
-
-    public  void put(String key, String mappings)
-    {
+    public void put(String key, String mappings) {
         System.out.println("Cache PUT key " + key + " mappings " + mappings);
-        ES_MAPPINGS_CACHE.put(key, mappings);
+        if (mappings != null)
+            ES_MAPPINGS_CACHE.put(key, mappings);
     }
 
-    public  boolean putIfNotExist(String key, String mappings) {
+    public boolean putIfNotExist(String key, String mappings) {
         if (!exists(key)) {
             put(key, mappings);
             return false;

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/cache/MappingsCachesTable.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/cache/MappingsCachesTable.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/cache/MappingsCachesTable.java
index 4de5d43..d5f9aa3 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/cache/MappingsCachesTable.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/extensions/spatial/mappings/cache/MappingsCachesTable.java
@@ -1,31 +1,40 @@
+/*
+ * Copyright (c) 2014, Jiri Jetmar. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
 package org.qi4j.index.elasticsearch.extensions.spatial.mappings.cache;
 
 import com.google.common.collect.HashBasedTable;
 import com.google.common.collect.Table;
 import org.qi4j.index.elasticsearch.ElasticSearchSupport;
 
-/**
- * Created by jj on 19.12.14.
- */
+
 public class MappingsCachesTable {
 
     private static final Table<String, String, MappingsCache> CACHES_TABLE = HashBasedTable.create();
 
-    public static  MappingsCache getMappingCache(String index, String type)
-    {
+    public static MappingsCache getMappingCache(String index, String type) {
         return CACHES_TABLE.get(index, type);
     }
 
-    public static MappingsCache getMappingCache(ElasticSearchSupport support)
-    {
+    public static MappingsCache getMappingCache(ElasticSearchSupport support) {
         if (!CACHES_TABLE.contains(support.index(), support.entitiesType())) {
             CACHES_TABLE.put(support.index(), support.entitiesType(), new MappingsCache(support));
         }
         return CACHES_TABLE.get(support.index(), support.entitiesType());
     }
 
-    public static void clear()
-    {
+    public static void clear() {
         CACHES_TABLE.clear();
     }
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/filesystem/ESFilesystemSupport.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/filesystem/ESFilesystemSupport.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/filesystem/ESFilesystemSupport.java
index 0baccbe..ccad851 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/filesystem/ESFilesystemSupport.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/filesystem/ESFilesystemSupport.java
@@ -58,25 +58,7 @@ public class ESFilesystemSupport
         index = config.index().get() == null ? DEFAULT_INDEX_NAME : config.index().get();
         indexNonAggregatedAssociations = config.indexNonAggregatedAssociations().get();
 
-        indexPointMappingMethod = config.indexPointMappingMethod() == null ?
-                ElasticSearchConfiguration.INDEX_MAPPING_POINT_METHOD.GEO_POINT : config.indexPointMappingMethod().get();
-
-        indexPointMappingMethod = ElasticSearchConfiguration.INDEX_MAPPING_POINT_METHOD.GEO_POINT;
-
-
-        System.out.println("---- TEST FileSystemSupport ---- " + config.spatial());
-        System.out.println("---- TEST FileSystemSupport enabled ---- " + config.spatial().get().Enabled());
-        System.out.println("---- TEST FileSystemSupport Type ---- " + config.spatial().get().Indexer().get().Method());
-        System.out.println("---- TEST FileSystemSupport Projection enabled ---- " + config.spatial().get().Indexer().get().Projection().get().ConversionEnabled() );
-        System.out.println("---- TEST FileSystemSupport Projection Accuracy ---- " + config.spatial().get().Indexer().get().Projection().get().ConversionEnabled() );
-
-
-        System.out.println("---- TEST FileSystemSupport Finder Enabled ---- " + config.spatial().get().Finder().get().Projection().get().ConversionEnabled() );
-        System.out.println("---- TEST FileSystemSupport Finder Accuracy ---- " + config.spatial().get().Finder().get().Projection().get().ConversionAccuracy() );
-
-        spatialConfiguration = config.spatial().get();
-
-
+        defaultSpatialConfiguration(config);
 
         String identity = hasIdentity.identity().get();
         Settings settings = ImmutableSettings.settingsBuilder().

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/internal/AbstractElasticSearchSupport.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/internal/AbstractElasticSearchSupport.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/internal/AbstractElasticSearchSupport.java
index 902d392..bf4543d 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/internal/AbstractElasticSearchSupport.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/internal/AbstractElasticSearchSupport.java
@@ -20,8 +20,10 @@ package org.qi4j.index.elasticsearch.internal;
 import org.elasticsearch.client.Client;
 import org.elasticsearch.common.settings.ImmutableSettings;
 import org.elasticsearch.common.xcontent.XContentFactory;
+import org.qi4j.api.configuration.Configuration;
 import org.qi4j.api.injection.scope.Structure;
 import org.qi4j.api.structure.Module;
+import org.qi4j.api.value.ValueBuilder;
 import org.qi4j.index.elasticsearch.ElasticSearchConfiguration;
 import org.qi4j.index.elasticsearch.ElasticSearchSupport;
 import org.qi4j.index.elasticsearch.extensions.spatial.configuration.SpatialConfiguration;
@@ -46,8 +48,6 @@ public abstract class AbstractElasticSearchSupport
 
     protected boolean indexNonAggregatedAssociations;
 
-    protected ElasticSearchConfiguration.INDEX_MAPPING_POINT_METHOD indexPointMappingMethod;
-
     protected SpatialConfiguration.Configuration spatialConfiguration;
 
 
@@ -110,6 +110,54 @@ public abstract class AbstractElasticSearchSupport
         // NOOP
     }
 
+    protected void defaultSpatialConfiguration(ElasticSearchConfiguration configuration)
+    {
+
+        if (  (configuration.spatial().get() == null) )
+        {
+            SpatialConfiguration.Configuration cConfig = module.newValueBuilder(SpatialConfiguration.Configuration.class).prototype();
+
+            SpatialConfiguration.IndexerConfiguration cIndexer = module.newValueBuilder(SpatialConfiguration.IndexerConfiguration.class).prototype();
+            SpatialConfiguration.IndexingMethod cIndexingMethod = module.newValueBuilder(SpatialConfiguration.IndexingMethod.class).prototype();
+            SpatialConfiguration.ProjectionSupport cProjectionIndexerSupport = module.newValueBuilder(SpatialConfiguration.ProjectionSupport.class).prototype();
+
+            SpatialConfiguration.FinderConfiguration cFinder = module.newValueBuilder(SpatialConfiguration.FinderConfiguration.class).prototype();
+            SpatialConfiguration.ProjectionSupport cProjectionFinderSupport = module.newValueBuilder(SpatialConfiguration.ProjectionSupport.class).prototype();
+
+
+
+            cIndexingMethod.Type().set(SpatialConfiguration.INDEXING_METHOD.GEO_POINT);
+            cIndexingMethod.Precision().set("2m");
+
+            cProjectionIndexerSupport.ConversionEnabled().set(true);
+            cProjectionIndexerSupport.ConversionAccuracy().set("2m");
+
+            // Setup Indexer
+            cIndexer.Method().set(cIndexingMethod);
+            cIndexer.Projection().set(cProjectionIndexerSupport);
+
+
+            cProjectionFinderSupport.ConversionEnabled().set(true);
+            cProjectionFinderSupport.ConversionAccuracy().set("2m");
+
+            // Setup Finder
+            cFinder.Projection().set(cProjectionFinderSupport);
+
+            // Setup Configuration
+            cConfig.Enabled().set(true);
+            cConfig.Indexer().set(cIndexer);
+            cConfig.Finder().set(cFinder);
+
+            spatialConfiguration = cConfig;
+
+        } else
+        {
+            // config available
+            spatialConfiguration = configuration.spatial().get();
+        }
+
+    }
+
     @Override
     public final Client client()
     {
@@ -135,9 +183,6 @@ public abstract class AbstractElasticSearchSupport
     }
 
     @Override
-    public final ElasticSearchConfiguration.INDEX_MAPPING_POINT_METHOD indexPointMappingMethod() { return indexPointMappingMethod; }
-
-    @Override
     public final SpatialConfiguration.Configuration spatialConfiguration()
     {
         return spatialConfiguration;

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/memory/ESMemorySupport.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/memory/ESMemorySupport.java b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/memory/ESMemorySupport.java
index e810bea..76bb786 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/memory/ESMemorySupport.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/qi4j/index/elasticsearch/memory/ESMemorySupport.java
@@ -58,13 +58,7 @@ public class ESMemorySupport
         index = config.index().get() == null ? DEFAULT_INDEX_NAME : config.index().get();
         indexNonAggregatedAssociations = config.indexNonAggregatedAssociations().get();
 
-        indexPointMappingMethod = config.indexPointMappingMethod() == null ?
-                ElasticSearchConfiguration.INDEX_MAPPING_POINT_METHOD.GEO_POINT : config.indexPointMappingMethod().get();
-
-        indexPointMappingMethod = ElasticSearchConfiguration.INDEX_MAPPING_POINT_METHOD.GEO_POINT;
-
-        System.out.println("---- TEST ---- " + config.spatial());
-
+        defaultSpatialConfiguration(config);
 
         String identity = hasIdentity.identity().get();
         Settings settings = ImmutableSettings.settingsBuilder().

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchComplexQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchComplexQueryTest.java b/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchComplexQueryTest.java
index 5504e9b..4aa59bc 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchComplexQueryTest.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchComplexQueryTest.java
@@ -25,6 +25,7 @@ import org.qi4j.api.common.Visibility;
 import org.qi4j.bootstrap.AssemblyException;
 import org.qi4j.bootstrap.ModuleAssembly;
 import org.qi4j.index.elasticsearch.assembly.ESFilesystemIndexQueryAssembler;
+import org.qi4j.index.elasticsearch.extensions.spatial.configuration.SpatialConfiguration;
 import org.qi4j.library.fileconfig.FileConfigurationOverride;
 import org.qi4j.library.fileconfig.FileConfigurationService;
 import org.qi4j.test.EntityTestAssembler;
@@ -56,6 +57,12 @@ public class ElasticSearchComplexQueryTest
 
         // Config module
         ModuleAssembly config = module.layer().module( "config" );
+        config.values(SpatialConfiguration.Configuration.class,
+                SpatialConfiguration.FinderConfiguration.class,
+                SpatialConfiguration.IndexerConfiguration.class,
+                SpatialConfiguration.IndexingMethod.class,
+                SpatialConfiguration.ProjectionSupport.class).
+                visibleIn(Visibility.application);
         new EntityTestAssembler().assemble( config );
 
         // Index/Query

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchFinderTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchFinderTest.java b/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchFinderTest.java
index 3766545..4429b8b 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchFinderTest.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchFinderTest.java
@@ -24,6 +24,7 @@ import org.qi4j.api.common.Visibility;
 import org.qi4j.bootstrap.AssemblyException;
 import org.qi4j.bootstrap.ModuleAssembly;
 import org.qi4j.index.elasticsearch.assembly.ESFilesystemIndexQueryAssembler;
+import org.qi4j.index.elasticsearch.extensions.spatial.configuration.SpatialConfiguration;
 import org.qi4j.library.fileconfig.FileConfigurationOverride;
 import org.qi4j.library.fileconfig.FileConfigurationService;
 import org.qi4j.test.EntityTestAssembler;
@@ -53,6 +54,12 @@ public class ElasticSearchFinderTest
 
         // Config module
         ModuleAssembly config = module.layer().module( "config" );
+        config.values(SpatialConfiguration.Configuration.class,
+                SpatialConfiguration.FinderConfiguration.class,
+                SpatialConfiguration.IndexerConfiguration.class,
+                SpatialConfiguration.IndexingMethod.class,
+                SpatialConfiguration.ProjectionSupport.class).
+                visibleIn(Visibility.application);
         new EntityTestAssembler().assemble( config );
 
         // Index/Query

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchQueryTest.java b/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchQueryTest.java
index cb8221d..1f02832 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchQueryTest.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchQueryTest.java
@@ -32,6 +32,7 @@ import org.qi4j.api.query.QueryBuilder;
 import org.qi4j.bootstrap.AssemblyException;
 import org.qi4j.bootstrap.ModuleAssembly;
 import org.qi4j.index.elasticsearch.assembly.ESFilesystemIndexQueryAssembler;
+import org.qi4j.index.elasticsearch.extensions.spatial.configuration.SpatialConfiguration;
 import org.qi4j.library.fileconfig.FileConfigurationOverride;
 import org.qi4j.library.fileconfig.FileConfigurationService;
 import org.qi4j.spi.query.EntityFinderException;
@@ -70,6 +71,12 @@ public class ElasticSearchQueryTest
 
         // Config module
         ModuleAssembly config = module.layer().module( "config" );
+        config.values(SpatialConfiguration.Configuration.class,
+                SpatialConfiguration.FinderConfiguration.class,
+                SpatialConfiguration.IndexerConfiguration.class,
+                SpatialConfiguration.IndexingMethod.class,
+                SpatialConfiguration.ProjectionSupport.class).
+                visibleIn(Visibility.application);
         new EntityTestAssembler().assemble( config );
 
         // Index/Query
@@ -116,38 +123,4 @@ public class ElasticSearchQueryTest
     {
         super.script42_DateTime();
     }
-
-    @Test
-    public void script53_Spatial_ST_WithIn()
-    {
-        QueryBuilder<City> qb = this.module.newQueryBuilder(City.class);
-        Query<City> query = unitOfWork.newQuery(
-                qb
-                        .where(
-                                ST_Within
-                                        (
-                                                templateFor(City.class).location(),
-                                                ST_GeometryFromText("POINT(3.139003 101.686854)"),
-                                                100,
-                                                TUnit.METER
-                                        )
-                        ));
-        System.out.println( "*** script53_Spatial_ST_WithIn: " + query );
-
-        System.out.println("Query Count " + query.count());
-
-        // System.out.println( "*** script01: " + query );
-        query.find();
-    }
-
-    @Test
-    public void script53_Spatial_ST_WithIn2() {
-        QueryBuilder<Person> qb = this.module.newQueryBuilder(Person.class);
-        Person person = templateFor(Person.class);
-        Query<Person> query = unitOfWork.newQuery(qb.where(
-                eq(person.dateTimeValue(), new DateTime("2010-03-04T13:24:35", UTC))));
-        System.out.println("*** script40_DateTime: " + query);
-
-        // verifyUnorderedResults(query, "Jack Doe");
-    }
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchTest.java b/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchTest.java
index 4bd673e..53ae6d7 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchTest.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ElasticSearchTest.java
@@ -36,6 +36,7 @@ import org.qi4j.api.unitofwork.UnitOfWorkCompletionException;
 import org.qi4j.bootstrap.AssemblyException;
 import org.qi4j.bootstrap.ModuleAssembly;
 import org.qi4j.index.elasticsearch.assembly.ESFilesystemIndexQueryAssembler;
+import org.qi4j.index.elasticsearch.extensions.spatial.configuration.SpatialConfiguration;
 import org.qi4j.library.fileconfig.FileConfigurationOverride;
 import org.qi4j.library.fileconfig.FileConfigurationService;
 import org.qi4j.test.AbstractQi4jTest;
@@ -128,6 +129,12 @@ public class ElasticSearchTest
     {
         // Config module
         ModuleAssembly config = module.layer().module( "config" );
+        config.values(SpatialConfiguration.Configuration.class,
+                SpatialConfiguration.FinderConfiguration.class,
+                SpatialConfiguration.IndexerConfiguration.class,
+                SpatialConfiguration.IndexingMethod.class,
+                SpatialConfiguration.ProjectionSupport.class).
+                visibleIn(Visibility.application);
         new EntityTestAssembler().assemble( config );
 
         // EntityStore

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9d71ec3c/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ImmenseTermTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ImmenseTermTest.java b/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ImmenseTermTest.java
index 6308f40..0a05788 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ImmenseTermTest.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/qi4j/index/elasticsearch/ImmenseTermTest.java
@@ -31,6 +31,7 @@ import org.qi4j.api.unitofwork.UnitOfWork;
 import org.qi4j.bootstrap.AssemblyException;
 import org.qi4j.bootstrap.ModuleAssembly;
 import org.qi4j.index.elasticsearch.assembly.ESFilesystemIndexQueryAssembler;
+import org.qi4j.index.elasticsearch.extensions.spatial.configuration.SpatialConfiguration;
 import org.qi4j.library.fileconfig.FileConfigurationOverride;
 import org.qi4j.library.fileconfig.FileConfigurationService;
 import org.qi4j.test.AbstractQi4jTest;
@@ -87,6 +88,12 @@ public class ImmenseTermTest
     {
         // Config module
         ModuleAssembly config = module.layer().module( "config" );
+        config.values(SpatialConfiguration.Configuration.class,
+                SpatialConfiguration.FinderConfiguration.class,
+                SpatialConfiguration.IndexerConfiguration.class,
+                SpatialConfiguration.IndexingMethod.class,
+                SpatialConfiguration.ProjectionSupport.class).
+                visibleIn(Visibility.application);
         new EntityTestAssembler().assemble( config );
 
         // EntityStore


Mime
View raw message