incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/2] git commit: Mores changes to the spatial implementation. All three strageties should now work.
Date Thu, 15 Aug 2013 19:00:50 GMT
Updated Branches:
  refs/heads/master 5e074f458 -> 6f7f71a4d


Mores changes to the spatial implementation.  All three strageties should now work.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/089c62c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/089c62c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/089c62c2

Branch: refs/heads/master
Commit: 089c62c2595ba89b69e7a69413d6f779efc341a5
Parents: 5e074f4
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Thu Aug 15 13:23:06 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Thu Aug 15 13:23:06 2013 -0400

----------------------------------------------------------------------
 .../apache/blur/analysis/BaseFieldManager.java  |  78 +++++++--
 .../org/apache/blur/analysis/FieldManager.java  |   2 +
 .../blur/analysis/FieldTypeDefinition.java      |  53 +++---
 .../type/CustomFieldTypeDefinition.java         |  15 +-
 .../type/DoubleFieldTypeDefinition.java         |  14 +-
 .../type/FieldLessFieldTypeDefinition.java      |  18 +-
 .../analysis/type/FloatFieldTypeDefinition.java |  14 +-
 .../analysis/type/IntFieldTypeDefinition.java   |  14 +-
 .../analysis/type/LongFieldTypeDefinition.java  |  14 +-
 .../type/NumericFieldTypeDefinition.java        |   4 +-
 .../type/SpatialFieldTypeDefinition.java        | 108 ------------
 .../type/StoredFieldTypeDefinition.java         |  15 +-
 .../type/StringFieldTypeDefinition.java         |  19 +-
 .../analysis/type/TextFieldTypeDefinition.java  |  18 +-
 .../spatial/BaseSpatialFieldTypeDefinition.java | 172 +++++++++++++++++++
 ...lPointVectorStrategyFieldTypeDefinition.java |  66 +++++++
 ...vePrefixTreeStrategyFieldTypeDefinition.java |  51 ++++++
 ...ryPrefixTreeStrategyFieldTypeDefinition.java |  47 +++++
 .../blur/lucene/search/SuperParserTest.java     |   4 +-
 19 files changed, 458 insertions(+), 268 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/BaseFieldManager.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/BaseFieldManager.java b/blur-query/src/main/java/org/apache/blur/analysis/BaseFieldManager.java
index b29a3a5..60b086d 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/BaseFieldManager.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/BaseFieldManager.java
@@ -30,13 +30,16 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.blur.analysis.type.DoubleFieldTypeDefinition;
 import org.apache.blur.analysis.type.FieldLessFieldTypeDefinition;
 import org.apache.blur.analysis.type.FloatFieldTypeDefinition;
-import org.apache.blur.analysis.type.SpatialFieldTypeDefinition;
 import org.apache.blur.analysis.type.IntFieldTypeDefinition;
 import org.apache.blur.analysis.type.LongFieldTypeDefinition;
 import org.apache.blur.analysis.type.NumericFieldTypeDefinition;
 import org.apache.blur.analysis.type.StoredFieldTypeDefinition;
 import org.apache.blur.analysis.type.StringFieldTypeDefinition;
 import org.apache.blur.analysis.type.TextFieldTypeDefinition;
+import org.apache.blur.analysis.type.spatial.BaseSpatialFieldTypeDefinition;
+import org.apache.blur.analysis.type.spatial.SpatialPointVectorStrategyFieldTypeDefinition;
+import org.apache.blur.analysis.type.spatial.SpatialRecursivePrefixTreeStrategyFieldTypeDefinition;
+import org.apache.blur.analysis.type.spatial.SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
 import org.apache.blur.thrift.generated.Column;
@@ -90,14 +93,16 @@ public abstract class BaseFieldManager extends FieldManager {
   public BaseFieldManager(String fieldLessField, final Analyzer defaultAnalyzerForQuerying, boolean strict,
       String defaultMissingFieldType, boolean defaultMissingFieldLessIndexing,
       Map<String, String> defaultMissingFieldProps) throws IOException {
-    _typeMap.put(TextFieldTypeDefinition.NAME, TextFieldTypeDefinition.class);
-    _typeMap.put(StringFieldTypeDefinition.NAME, StringFieldTypeDefinition.class);
-    _typeMap.put(StoredFieldTypeDefinition.NAME, StoredFieldTypeDefinition.class);
-    _typeMap.put(IntFieldTypeDefinition.NAME, IntFieldTypeDefinition.class);
-    _typeMap.put(LongFieldTypeDefinition.NAME, LongFieldTypeDefinition.class);
-    _typeMap.put(DoubleFieldTypeDefinition.NAME, DoubleFieldTypeDefinition.class);
-    _typeMap.put(FloatFieldTypeDefinition.NAME, FloatFieldTypeDefinition.class);
-    _typeMap.put(SpatialFieldTypeDefinition.NAME, SpatialFieldTypeDefinition.class);
+    registerType(TextFieldTypeDefinition.class);
+    registerType(StringFieldTypeDefinition.class);
+    registerType(StoredFieldTypeDefinition.class);
+    registerType(IntFieldTypeDefinition.class);
+    registerType(LongFieldTypeDefinition.class);
+    registerType(DoubleFieldTypeDefinition.class);
+    registerType(FloatFieldTypeDefinition.class);
+    registerType(SpatialPointVectorStrategyFieldTypeDefinition.class);
+    registerType(SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition.class);
+    registerType(SpatialRecursivePrefixTreeStrategyFieldTypeDefinition.class);
     _fieldLessField = fieldLessField;
     _strict = strict;
     _defaultMissingFieldLessIndexing = defaultMissingFieldLessIndexing;
@@ -118,7 +123,7 @@ public abstract class BaseFieldManager extends FieldManager {
         if (fieldTypeDefinition == null) {
           return defaultAnalyzerForQuerying;
         }
-        return fieldTypeDefinition.getAnalyzerForQuery();
+        return fieldTypeDefinition.getAnalyzerForQuery(fieldName);
       }
 
       @Override
@@ -139,7 +144,7 @@ public abstract class BaseFieldManager extends FieldManager {
         if (fieldTypeDefinition == null) {
           throw new RuntimeException("Field [" + fieldName + "] not found.");
         }
-        return fieldTypeDefinition.getAnalyzerForQuery();
+        return fieldTypeDefinition.getAnalyzerForQuery(fieldName);
       }
 
       @Override
@@ -150,6 +155,22 @@ public abstract class BaseFieldManager extends FieldManager {
   }
 
   @Override
+  public void registerType(Class<? extends FieldTypeDefinition> c) {
+    try {
+      FieldTypeDefinition fieldTypeDefinition = c.newInstance();
+      String name = fieldTypeDefinition.getName();
+      if (_typeMap.containsKey(name)) {
+        throw new RuntimeException("Type [" + name + "] is already registered.");
+      }
+      _typeMap.put(name, c);
+    } catch (InstantiationException e) {
+      throw new RuntimeException("The default constructor of the class [" + c + "] is missing.", e);
+    } catch (IllegalAccessException e) {
+      throw new RuntimeException("The scope of the class [" + c + "] is not public.", e);
+    }
+  }
+
+  @Override
   public List<Field> getFields(String rowId, Record record) throws IOException {
     List<Field> fields = new ArrayList<Field>();
     String family = record.getFamily();
@@ -275,16 +296,28 @@ public abstract class BaseFieldManager extends FieldManager {
     if (fieldTypeDefinition != null) {
       return false;
     }
-    if (!tryToStore(fieldName, fieldLessIndexing, fieldType, props)) {
-      return false;
-    }
     fieldTypeDefinition = newFieldTypeDefinition(fieldName, fieldLessIndexing, fieldType, props);
-    registerFieldTypeDefinition(fieldName, fieldTypeDefinition);
+    synchronized (_fieldNameToDefMap) {
+      for (String alternateFieldName : fieldTypeDefinition.getAlternateFieldNames()) {
+        if (_fieldNameToDefMap.containsKey(alternateFieldName)) {
+          throw new IllegalArgumentException("Alternate fieldName collision of [" + alternateFieldName
+              + "] from field type definition [" + fieldTypeDefinition
+              + "], this field type definition cannot be added.");
+        }
+      }
+      if (!tryToStore(fieldName, fieldLessIndexing, fieldType, props)) {
+        return false;
+      }
+      registerFieldTypeDefinition(fieldName, fieldTypeDefinition);
+    }
     return true;
   }
 
   protected void registerFieldTypeDefinition(String fieldName, FieldTypeDefinition fieldTypeDefinition) {
     _fieldNameToDefMap.put(fieldName, fieldTypeDefinition);
+    for (String alternateFieldName : fieldTypeDefinition.getAlternateFieldNames()) {
+      _fieldNameToDefMap.put(alternateFieldName, fieldTypeDefinition);
+    }
     String baseFieldName = getBaseFieldName(fieldName);
     String subColumnName = getSubColumnName(fieldName);
     if (subColumnName != null) {
@@ -364,7 +397,7 @@ public abstract class BaseFieldManager extends FieldManager {
     if (fieldTypeDefinition == null) {
       throw new AnalyzerNotFoundException(fieldName);
     }
-    return fieldTypeDefinition.getAnalyzerForIndex();
+    return fieldTypeDefinition.getAnalyzerForIndex(fieldName);
   }
 
   @Override
@@ -373,11 +406,18 @@ public abstract class BaseFieldManager extends FieldManager {
     if (fieldTypeDefinition == null) {
       throw new AnalyzerNotFoundException(fieldName);
     }
-    return fieldTypeDefinition.getAnalyzerForQuery();
+    return fieldTypeDefinition.getAnalyzerForQuery(fieldName);
+  }
+
+  public void addColumnDefinitionGisPointVector(String family, String columnName) throws IOException {
+    addColumnDefinition(family, columnName, null, false, SpatialPointVectorStrategyFieldTypeDefinition.NAME, null);
   }
 
-  public void addColumnDefinitionGis(String family, String columnName) throws IOException {
-    addColumnDefinition(family, columnName, null, false, SpatialFieldTypeDefinition.NAME, null);
+  public void addColumnDefinitionGisRecursivePrefixTree(String family, String columnName) throws IOException {
+    Map<String, String> props = new HashMap<String, String>();
+    props.put(BaseSpatialFieldTypeDefinition.SPATIAL_PREFIX_TREE, BaseSpatialFieldTypeDefinition.GEOHASH_PREFIX_TREE);
+    addColumnDefinition(family, columnName, null, false, SpatialRecursivePrefixTreeStrategyFieldTypeDefinition.NAME,
+        props);
   }
 
   public void addColumnDefinitionInt(String family, String columnName) throws IOException {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/FieldManager.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/FieldManager.java b/blur-query/src/main/java/org/apache/blur/analysis/FieldManager.java
index ac95494..6b4fe23 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/FieldManager.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/FieldManager.java
@@ -250,4 +250,6 @@ public abstract class FieldManager {
    */
   public abstract Query getCustomQuery(String field, String text) throws IOException;
 
+  public abstract void registerType(Class<? extends FieldTypeDefinition> c);
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/FieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/FieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/FieldTypeDefinition.java
index 469decd..96c84d3 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/FieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/FieldTypeDefinition.java
@@ -16,17 +16,19 @@ package org.apache.blur.analysis;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.blur.thrift.generated.Column;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Field;
-import org.apache.lucene.document.FieldType;
 import org.apache.lucene.search.Query;
 
 public abstract class FieldTypeDefinition {
-  
+
+  protected static final Collection<String> EMPTY_COLLECTION = Arrays.asList(new String[]{});
   protected boolean _fieldLessIndexing;
 
   /**
@@ -37,6 +39,25 @@ public abstract class FieldTypeDefinition {
   public abstract String getName();
 
   /**
+   * Gets the alternate field names for this instance. For example in the
+   * PointVectorStrategy, there are two field that are created with suffixes
+   * from the base field name. For example if the base field name was
+   * "fam1.col1" then the two suffix names would be "fam1.col1__x" and
+   * "fam1.col1__y".
+   * 
+   * <ul>
+   * <li>fam1.col1 - This field is used for storage.</li>
+   * <li>fam1.col1__x - This field is used to index the x component.</li>
+   * <li>fam1.col1__y - This field is used to index the y component.</li>
+   * </ul
+   * 
+   * @return an {@link Iterable} of {@link String}s.
+   */
+  public Collection<String> getAlternateFieldNames() {
+    return EMPTY_COLLECTION;
+  }
+
+  /**
    * Configures the field type.
    * 
    * @param properties
@@ -65,36 +86,28 @@ public abstract class FieldTypeDefinition {
   public abstract Iterable<? extends Field> getFieldsForSubColumn(String family, Column column, String subName);
 
   /**
-   * Gets the {@link FieldType} for stored version. This is the normal Column
-   * for Blur.
-   * 
-   * @return the {@link FieldType}.
-   */
-  public abstract FieldType getStoredFieldType();
-
-  /**
-   * Gets the {@link FieldType} for non-stored version. This is the sub Column
-   * for Blur.
-   * 
-   * @return the {@link FieldType}.
-   */
-  public abstract FieldType getNotStoredFieldType();
-
-  /**
    * Gets the {@link Analyzer} for indexing this should be the same for the
    * querying unless you have a good reason.
    * 
+   * @param fieldName
+   *          the field name to get the analyzer, this could be the base field
+   *          name or the alternative.
+   * 
    * @return the {@link Analyzer}.
    */
-  public abstract Analyzer getAnalyzerForIndex();
+  public abstract Analyzer getAnalyzerForIndex(String fieldName);
 
   /**
    * Gets the {@link Analyzer} for querying this should be the same for the
    * indexing unless you have a good reason.
    * 
+   * @param fieldName
+   *          the field name to get the analyzer, this could be the base field
+   *          name or the alternative.
+   * 
    * @return the {@link Analyzer}.
    */
-  public abstract Analyzer getAnalyzerForQuery();
+  public abstract Analyzer getAnalyzerForQuery(String fieldName);
 
   protected Iterable<? extends Field> makeIterable(final Field field) {
     return new Iterable<Field>() {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/CustomFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/CustomFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/CustomFieldTypeDefinition.java
index c91c9eb..936541c 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/CustomFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/CustomFieldTypeDefinition.java
@@ -19,7 +19,6 @@ package org.apache.blur.analysis.type;
 import org.apache.blur.analysis.FieldTypeDefinition;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.core.KeywordAnalyzer;
-import org.apache.lucene.document.FieldType;
 
 public abstract class CustomFieldTypeDefinition extends FieldTypeDefinition {
 
@@ -27,22 +26,12 @@ public abstract class CustomFieldTypeDefinition extends FieldTypeDefinition {
   private final Analyzer _queryAnalyzer = new KeywordAnalyzer();
 
   @Override
-  public final FieldType getStoredFieldType() {
+  public Analyzer getAnalyzerForIndex(String fieldName) {
     throw new RuntimeException(NOT_SUPPORTED);
   }
 
   @Override
-  public final FieldType getNotStoredFieldType() {
-    throw new RuntimeException(NOT_SUPPORTED);
-  }
-
-  @Override
-  public final Analyzer getAnalyzerForIndex() {
-    throw new RuntimeException(NOT_SUPPORTED);
-  }
-
-  @Override
-  public final Analyzer getAnalyzerForQuery() {
+  public Analyzer getAnalyzerForQuery(String fieldName) {
     return _queryAnalyzer;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/DoubleFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/DoubleFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/DoubleFieldTypeDefinition.java
index c995c49..4c38d33 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/DoubleFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/DoubleFieldTypeDefinition.java
@@ -56,24 +56,14 @@ public class DoubleFieldTypeDefinition extends NumericFieldTypeDefinition {
   @Override
   public Iterable<? extends Field> getFieldsForColumn(String family, Column column) {
     String name = getName(family, column.getName());
-    DoubleField field = new DoubleField(name, Double.parseDouble(column.getValue()), getStoredFieldType());
+    DoubleField field = new DoubleField(name, Double.parseDouble(column.getValue()), _typeStored);
     return makeIterable(field);
   }
 
   @Override
   public Iterable<? extends Field> getFieldsForSubColumn(String family, Column column, String subName) {
     String name = getName(family, column.getName(), subName);
-    return makeIterable(new DoubleField(name, Double.parseDouble(column.getValue()), getNotStoredFieldType()));
-  }
-
-  @Override
-  public FieldType getStoredFieldType() {
-    return _typeStored;
-  }
-
-  @Override
-  public FieldType getNotStoredFieldType() {
-    return _typeNotStored;
+    return makeIterable(new DoubleField(name, Double.parseDouble(column.getValue()), _typeNotStored));
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/FieldLessFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/FieldLessFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/FieldLessFieldTypeDefinition.java
index 74aa4f9..2824d85 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/FieldLessFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/FieldLessFieldTypeDefinition.java
@@ -50,34 +50,24 @@ public class FieldLessFieldTypeDefinition extends FieldTypeDefinition {
   @Override
   public Iterable<? extends Field> getFieldsForColumn(String family, Column column) {
     String name = getName(family, column.getName());
-    Field field = new Field(name, column.getValue(), getStoredFieldType());
+    Field field = new Field(name, column.getValue(), TYPE_NOT_STORED);
     return makeIterable(field);
   }
 
   @Override
   public Iterable<? extends Field> getFieldsForSubColumn(String family, Column column, String subName) {
     String name = getName(family, column.getName(), subName);
-    Field field = new Field(name, column.getValue(), getNotStoredFieldType());
+    Field field = new Field(name, column.getValue(), TYPE_NOT_STORED);
     return makeIterable(field);
   }
 
   @Override
-  public FieldType getStoredFieldType() {
-    return TYPE_NOT_STORED;
-  }
-
-  @Override
-  public FieldType getNotStoredFieldType() {
-    return TYPE_NOT_STORED;
-  }
-
-  @Override
-  public Analyzer getAnalyzerForIndex() {
+  public Analyzer getAnalyzerForIndex(String fieldName) {
     return new NoStopWordStandardAnalyzer();
   }
 
   @Override
-  public Analyzer getAnalyzerForQuery() {
+  public Analyzer getAnalyzerForQuery(String fieldName) {
     return new NoStopWordStandardAnalyzer();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/FloatFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/FloatFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/FloatFieldTypeDefinition.java
index c6e4f2a..fcbdc20 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/FloatFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/FloatFieldTypeDefinition.java
@@ -56,24 +56,14 @@ public class FloatFieldTypeDefinition extends NumericFieldTypeDefinition {
   @Override
   public Iterable<? extends Field> getFieldsForColumn(String family, Column column) {
     String name = getName(family, column.getName());
-    FloatField field = new FloatField(name, Float.parseFloat(column.getValue()), getStoredFieldType());
+    FloatField field = new FloatField(name, Float.parseFloat(column.getValue()), _typeStored);
     return makeIterable(field);
   }
 
   @Override
   public Iterable<? extends Field> getFieldsForSubColumn(String family, Column column, String subName) {
     String name = getName(family, column.getName(), subName);
-    return makeIterable(new FloatField(name, Float.parseFloat(column.getValue()), getNotStoredFieldType()));
-  }
-
-  @Override
-  public FieldType getStoredFieldType() {
-    return _typeStored;
-  }
-
-  @Override
-  public FieldType getNotStoredFieldType() {
-    return _typeNotStored;
+    return makeIterable(new FloatField(name, Float.parseFloat(column.getValue()), _typeNotStored));
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/IntFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/IntFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/IntFieldTypeDefinition.java
index 1229aab..cd26f08 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/IntFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/IntFieldTypeDefinition.java
@@ -56,24 +56,14 @@ public class IntFieldTypeDefinition extends NumericFieldTypeDefinition {
   @Override
   public Iterable<? extends Field> getFieldsForColumn(String family, Column column) {
     String name = getName(family, column.getName());
-    IntField field = new IntField(name, Integer.parseInt(column.getValue()), getStoredFieldType());
+    IntField field = new IntField(name, Integer.parseInt(column.getValue()), _typeStored);
     return makeIterable(field);
   }
 
   @Override
   public Iterable<? extends Field> getFieldsForSubColumn(String family, Column column, String subName) {
     String name = getName(family, column.getName(), subName);
-    return makeIterable(new IntField(name, Integer.parseInt(column.getValue()), getNotStoredFieldType()));
-  }
-
-  @Override
-  public FieldType getStoredFieldType() {
-    return _typeStored;
-  }
-
-  @Override
-  public FieldType getNotStoredFieldType() {
-    return _typeNotStored;
+    return makeIterable(new IntField(name, Integer.parseInt(column.getValue()), _typeNotStored));
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/LongFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/LongFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/LongFieldTypeDefinition.java
index 14fe720..aa7d08d 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/LongFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/LongFieldTypeDefinition.java
@@ -56,24 +56,14 @@ public class LongFieldTypeDefinition extends NumericFieldTypeDefinition {
   @Override
   public Iterable<? extends Field> getFieldsForColumn(String family, Column column) {
     String name = getName(family, column.getName());
-    LongField field = new LongField(name, Long.parseLong(column.getValue()), getStoredFieldType());
+    LongField field = new LongField(name, Long.parseLong(column.getValue()), _typeStored);
     return makeIterable(field);
   }
 
   @Override
   public Iterable<? extends Field> getFieldsForSubColumn(String family, Column column, String subName) {
     String name = getName(family, column.getName(), subName);
-    return makeIterable(new LongField(name, Long.parseLong(column.getValue()), getNotStoredFieldType()));
-  }
-
-  @Override
-  public FieldType getStoredFieldType() {
-    return _typeStored;
-  }
-
-  @Override
-  public FieldType getNotStoredFieldType() {
-    return _typeNotStored;
+    return makeIterable(new LongField(name, Long.parseLong(column.getValue()), _typeNotStored));
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/NumericFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/NumericFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/NumericFieldTypeDefinition.java
index 69f016f..2d0921e 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/NumericFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/NumericFieldTypeDefinition.java
@@ -29,13 +29,13 @@ public abstract class NumericFieldTypeDefinition extends FieldTypeDefinition {
   protected int _precisionStep = NumericUtils.PRECISION_STEP_DEFAULT;
 
   @Override
-  public final Analyzer getAnalyzerForIndex() {
+  public final Analyzer getAnalyzerForIndex(String fieldName) {
     // shouldn't be used ever
     return new KeywordAnalyzer();
   }
 
   @Override
-  public final Analyzer getAnalyzerForQuery() {
+  public final Analyzer getAnalyzerForQuery(String fieldName) {
     return new KeywordAnalyzer();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/SpatialFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/SpatialFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/SpatialFieldTypeDefinition.java
deleted file mode 100644
index 7197144..0000000
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/SpatialFieldTypeDefinition.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.apache.blur.analysis.type;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.blur.analysis.type.spatial.SpatialArgsParser;
-import org.apache.blur.thrift.generated.Column;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.StoredField;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.spatial.SpatialStrategy;
-import org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy;
-import org.apache.lucene.spatial.prefix.tree.GeohashPrefixTree;
-import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
-import org.apache.lucene.spatial.query.SpatialArgs;
-
-import com.spatial4j.core.context.SpatialContext;
-import com.spatial4j.core.io.ShapeReadWriter;
-import com.spatial4j.core.shape.Shape;
-
-public class SpatialFieldTypeDefinition extends CustomFieldTypeDefinition {
-
-  private static final String MAX_LEVELS = "maxLevels";
-  public static final String NAME = "spatial";
-
-  private SpatialStrategy _strategy;
-  private SpatialContext _ctx;
-  private ShapeReadWriter<SpatialContext> _shapeReadWriter;
-
-  @Override
-  public String getName() {
-    return NAME;
-  }
-
-  @Override
-  public void configure(String fieldNameForThisInstance, Map<String, String> properties) {
-    _ctx = SpatialContext.GEO;
-    String maxLevelsStr = properties.get(MAX_LEVELS);
-    int maxLevels = 11;
-    if (maxLevelsStr != null) {
-      maxLevels = Integer.parseInt(maxLevelsStr.trim());
-    }
-    SpatialPrefixTree grid = new GeohashPrefixTree(_ctx, maxLevels);
-    _strategy = new RecursivePrefixTreeStrategy(grid, fieldNameForThisInstance);
-    _shapeReadWriter = new ShapeReadWriter<SpatialContext>(_ctx);
-  }
-
-  @Override
-  public Iterable<? extends Field> getFieldsForColumn(String family, Column column) {
-    String name = getName(family, column.getName());
-    if (!_strategy.getFieldName().equals(name)) {
-      throw new RuntimeException("Strategy name and column name do not match.");
-    }
-    List<Field> fields = new ArrayList<Field>();
-    Shape shape = getShape(column);
-    for (Field f : _strategy.createIndexableFields(shape)) {
-      fields.add(f);
-    }
-    fields.add(new StoredField(name, cleanup(shape)));
-    return fields;
-  }
-
-  @Override
-  public Iterable<? extends Field> getFieldsForSubColumn(String family, Column column, String subName) {
-    String name = getName(family, column.getName(), subName);
-    if (!_strategy.getFieldName().equals(name)) {
-      throw new RuntimeException("Strategy name and column name do not match.");
-    }
-    List<Field> fields = new ArrayList<Field>();
-    Shape shape = getShape(column);
-    for (Field f : _strategy.createIndexableFields(shape)) {
-      fields.add(f);
-    }
-    return fields;
-  }
-
-  @Override
-  public Query getCustomQuery(String text) {
-    SpatialArgs args = SpatialArgsParser.parse(text, _shapeReadWriter);
-    return _strategy.makeQuery(args);
-  }
-
-  private Shape getShape(Column column) {
-    return _shapeReadWriter.readShape(column.getValue());
-  }
-
-  private String cleanup(Shape shape) {
-    return _shapeReadWriter.writeShape(shape);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/StoredFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/StoredFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/StoredFieldTypeDefinition.java
index 3febf40..215ee4f 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/StoredFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/StoredFieldTypeDefinition.java
@@ -24,7 +24,6 @@ import org.apache.blur.thrift.generated.Column;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.core.KeywordAnalyzer;
 import org.apache.lucene.document.Field;
-import org.apache.lucene.document.FieldType;
 import org.apache.lucene.document.StoredField;
 
 public class StoredFieldTypeDefinition extends FieldTypeDefinition {
@@ -54,23 +53,13 @@ public class StoredFieldTypeDefinition extends FieldTypeDefinition {
   }
 
   @Override
-  public FieldType getStoredFieldType() {
-    return StoredField.TYPE;
-  }
-
-  @Override
-  public FieldType getNotStoredFieldType() {
-    return StoredField.TYPE;
-  }
-
-  @Override
-  public Analyzer getAnalyzerForIndex() {
+  public Analyzer getAnalyzerForIndex(String fieldName) {
     // shouldn't be used ever
     return new KeywordAnalyzer();
   }
 
   @Override
-  public Analyzer getAnalyzerForQuery() {
+  public Analyzer getAnalyzerForQuery(String fieldName) {
     return new KeywordAnalyzer();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/StringFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/StringFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/StringFieldTypeDefinition.java
index 221720b..5e3ac2f 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/StringFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/StringFieldTypeDefinition.java
@@ -23,7 +23,6 @@ import org.apache.blur.thrift.generated.Column;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.core.KeywordAnalyzer;
 import org.apache.lucene.document.Field;
-import org.apache.lucene.document.FieldType;
 import org.apache.lucene.document.StringField;
 
 public class StringFieldTypeDefinition extends FieldTypeDefinition {
@@ -43,35 +42,25 @@ public class StringFieldTypeDefinition extends FieldTypeDefinition {
   @Override
   public Iterable<? extends Field> getFieldsForColumn(String family, Column column) {
     String name = getName(family, column.getName());
-    Field field = new Field(name, column.getValue(), getStoredFieldType());
+    Field field = new Field(name, column.getValue(), StringField.TYPE_STORED);
     return makeIterable(field);
   }
 
   @Override
   public Iterable<? extends Field> getFieldsForSubColumn(String family, Column column, String subName) {
     String name = getName(family, column.getName(), subName);
-    Field field = new Field(name, column.getValue(), getNotStoredFieldType());
+    Field field = new Field(name, column.getValue(), StringField.TYPE_NOT_STORED);
     return makeIterable(field);
   }
 
   @Override
-  public FieldType getStoredFieldType() {
-    return StringField.TYPE_STORED;
-  }
-
-  @Override
-  public FieldType getNotStoredFieldType() {
-    return StringField.TYPE_NOT_STORED;
-  }
-
-  @Override
-  public Analyzer getAnalyzerForIndex() {
+  public Analyzer getAnalyzerForIndex(String fieldName) {
     // shouldn't be used ever
     return new KeywordAnalyzer();
   }
 
   @Override
-  public Analyzer getAnalyzerForQuery() {
+  public Analyzer getAnalyzerForQuery(String fieldName) {
     return new KeywordAnalyzer();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/TextFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/TextFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/TextFieldTypeDefinition.java
index b64caed..3ff4b23 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/TextFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/TextFieldTypeDefinition.java
@@ -55,34 +55,24 @@ public class TextFieldTypeDefinition extends FieldTypeDefinition {
   @Override
   public Iterable<? extends Field> getFieldsForColumn(String family, Column column) {
     String name = getName(family, column.getName());
-    Field field = new Field(name, column.getValue(), getStoredFieldType());
+    Field field = new Field(name, column.getValue(), TYPE_STORED);
     return makeIterable(field);
   }
 
   @Override
   public Iterable<? extends Field> getFieldsForSubColumn(String family, Column column, String subName) {
     String name = getName(family, column.getName(), subName);
-    Field field = new Field(name, column.getValue(), getNotStoredFieldType());
+    Field field = new Field(name, column.getValue(), TYPE_NOT_STORED);
     return makeIterable(field);
   }
 
   @Override
-  public FieldType getStoredFieldType() {
-    return TYPE_STORED;
-  }
-
-  @Override
-  public FieldType getNotStoredFieldType() {
-    return TYPE_NOT_STORED;
-  }
-
-  @Override
-  public Analyzer getAnalyzerForIndex() {
+  public Analyzer getAnalyzerForIndex(String fieldName) {
     return new NoStopWordStandardAnalyzer();
   }
 
   @Override
-  public Analyzer getAnalyzerForQuery() {
+  public Analyzer getAnalyzerForQuery(String fieldName) {
     return new NoStopWordStandardAnalyzer();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/BaseSpatialFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/BaseSpatialFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/BaseSpatialFieldTypeDefinition.java
new file mode 100644
index 0000000..a36e948
--- /dev/null
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/BaseSpatialFieldTypeDefinition.java
@@ -0,0 +1,172 @@
+package org.apache.blur.analysis.type.spatial;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.blur.analysis.type.CustomFieldTypeDefinition;
+import org.apache.blur.thrift.generated.Column;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StoredField;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.spatial.SpatialStrategy;
+import org.apache.lucene.spatial.prefix.tree.GeohashPrefixTree;
+import org.apache.lucene.spatial.prefix.tree.QuadPrefixTree;
+import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
+import org.apache.lucene.spatial.query.SpatialArgs;
+import org.apache.lucene.spatial.query.SpatialOperation;
+
+import com.spatial4j.core.context.SpatialContext;
+import com.spatial4j.core.io.ShapeReadWriter;
+import com.spatial4j.core.shape.Shape;
+
+public abstract class BaseSpatialFieldTypeDefinition extends CustomFieldTypeDefinition {
+
+  public static final String GEOHASH_PREFIX_TREE = "GeohashPrefixTree";
+  public static final String QUAD_PREFIX_TREE = "QuadPrefixTree";
+  public static final String SPATIAL_PREFIX_TREE = "spatialPrefixTree";
+  public static final String MAX_LEVELS = "maxLevels";
+
+  protected SpatialStrategy _strategy;
+  protected SpatialContext _ctx;
+  protected ShapeReadWriter<SpatialContext> _shapeReadWriter;
+  protected List<SpatialOperation> _supportedOperations;
+  protected List<Class<? extends Shape>> _supportedIndexedShapes;
+
+  @Override
+  public Iterable<? extends Field> getFieldsForColumn(String family, Column column) {
+    synchronized (_strategy) {
+      String name = getName(family, column.getName());
+      if (!_strategy.getFieldName().equals(name)) {
+        throw new RuntimeException("Strategy name and column name do not match.");
+      }
+      List<Field> fields = new ArrayList<Field>();
+      Shape shape = getShape(column);
+      checkShape(shape);
+      for (Field f : _strategy.createIndexableFields(shape)) {
+        fields.add(f);
+      }
+      fields.add(new StoredField(name, column.getValue()));
+      return fields;
+    }
+  }
+
+  @Override
+  public Iterable<? extends Field> getFieldsForSubColumn(String family, Column column, String subName) {
+    synchronized (_strategy) {
+      String name = getName(family, column.getName(), subName);
+      if (!_strategy.getFieldName().equals(name)) {
+        throw new RuntimeException("Strategy name and column name do not match.");
+      }
+      List<Field> fields = new ArrayList<Field>();
+      Shape shape = getShape(column);
+      checkShape(shape);
+      for (Field f : _strategy.createIndexableFields(shape)) {
+        fields.add(f);
+      }
+      return fields;
+    }
+  }
+
+  @Override
+  public Query getCustomQuery(String text) {
+    SpatialArgs args = SpatialArgsParser.parse(text, _shapeReadWriter);
+    checkSpatialArgs(args);
+    synchronized (_strategy) {
+      return _strategy.makeQuery(args);  
+    }
+  }
+
+  protected void checkShape(Shape shape) {
+    for (Class<? extends Shape> shapeType : _supportedIndexedShapes) {
+      if (shapeType.isInstance(shape)) {
+        return;
+      }
+    }
+    throw new IllegalArgumentException(_strategy.getClass().getName() + " only supports [" + _supportedIndexedShapes
+        + "] operation.");
+  }
+
+  protected void checkSpatialArgs(SpatialArgs args) {
+    SpatialOperation operation = args.getOperation();
+    for (SpatialOperation so : _supportedOperations) {
+      if (operation == so) {
+        return;
+      }
+    }
+    throw new IllegalArgumentException(_strategy.getClass().getName() + " only supports [" + _supportedOperations
+        + "] operation.");
+  }
+
+  protected Shape getShape(Column column) {
+    return _shapeReadWriter.readShape(column.getValue());
+  }
+
+  protected SpatialPrefixTree getSpatialPrefixTree(Map<String, String> properties) {
+    String spatialPrefixTreeStr = properties.get(SPATIAL_PREFIX_TREE);
+    if (spatialPrefixTreeStr.equals(GEOHASH_PREFIX_TREE)) {
+      int maxLevels = getMaxLevels(properties);
+      return new GeohashPrefixTree(_ctx, maxLevels);
+    } else if (spatialPrefixTreeStr.equals(QUAD_PREFIX_TREE)) {
+      int maxLevels = getMaxLevels(properties);
+      return new QuadPrefixTree(_ctx, maxLevels);
+    } else {
+      throw new RuntimeException("Unknown spatialPrefixTreeStr [" + spatialPrefixTreeStr + "]");
+    }
+  }
+
+  protected int getMaxLevels(Map<String, String> properties) {
+    String maxLevelsStr = properties.get(MAX_LEVELS);
+    int maxLevels = 11;
+    if (maxLevelsStr != null) {
+      maxLevels = Integer.parseInt(maxLevelsStr.trim());
+    }
+    return maxLevels;
+  }
+
+  public List<SpatialOperation> getSupportedOperations() {
+    return _supportedOperations;
+  }
+
+  public void setSupportedOperations(List<SpatialOperation> supportedOperations) {
+    _supportedOperations = supportedOperations;
+  }
+
+  public void addSupportedOperations(SpatialOperation so) {
+    if (_supportedOperations == null) {
+      _supportedOperations = new ArrayList<SpatialOperation>();
+    }
+    _supportedOperations.add(so);
+  }
+
+  public List<Class<? extends Shape>> getSupportedIndexedShapes() {
+    return _supportedIndexedShapes;
+  }
+
+  public void setSupportedIndexedShapes(List<Class<? extends Shape>> supportedIndexedShapes) {
+    _supportedIndexedShapes = supportedIndexedShapes;
+  }
+
+  public void addSupportedIndexedShapes(Class<? extends Shape> c) {
+    if (_supportedIndexedShapes == null) {
+      _supportedIndexedShapes = new ArrayList<Class<? extends Shape>>();
+    }
+    _supportedIndexedShapes.add(c);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialPointVectorStrategyFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialPointVectorStrategyFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialPointVectorStrategyFieldTypeDefinition.java
new file mode 100644
index 0000000..46149ab
--- /dev/null
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialPointVectorStrategyFieldTypeDefinition.java
@@ -0,0 +1,66 @@
+package org.apache.blur.analysis.type.spatial;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.core.KeywordAnalyzer;
+import org.apache.lucene.spatial.query.SpatialOperation;
+import org.apache.lucene.spatial.vector.PointVectorStrategy;
+
+import com.spatial4j.core.context.SpatialContext;
+import com.spatial4j.core.io.ShapeReadWriter;
+import com.spatial4j.core.shape.Point;
+
+public class SpatialPointVectorStrategyFieldTypeDefinition extends BaseSpatialFieldTypeDefinition {
+
+  public static final String NAME = "geo-pointvector";
+
+  private Collection<String> _alternateFieldNames;
+
+  @Override
+  public String getName() {
+    return NAME;
+  }
+
+  @Override
+  public void configure(String fieldNameForThisInstance, Map<String, String> properties) {
+    _ctx = SpatialContext.GEO;
+    _strategy = new PointVectorStrategy(_ctx, fieldNameForThisInstance);
+    _shapeReadWriter = new ShapeReadWriter<SpatialContext>(_ctx);
+    _alternateFieldNames = Arrays.asList(fieldNameForThisInstance + PointVectorStrategy.SUFFIX_X,
+        fieldNameForThisInstance + PointVectorStrategy.SUFFIX_Y);
+    addSupportedIndexedShapes(Point.class);
+    addSupportedOperations(SpatialOperation.Intersects);
+  }
+
+  @Override
+  public Collection<String> getAlternateFieldNames() {
+    return _alternateFieldNames;
+  }
+
+  @Override
+  public Analyzer getAnalyzerForIndex(String fieldName) {
+    // This happens because the doubles are tokenized but the analyzer is
+    // fetched from the Field, but the offset is still fetched from the base
+    // analyzer. This seems like a bug.
+    return new KeywordAnalyzer();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialRecursivePrefixTreeStrategyFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialRecursivePrefixTreeStrategyFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialRecursivePrefixTreeStrategyFieldTypeDefinition.java
new file mode 100644
index 0000000..8a82236
--- /dev/null
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialRecursivePrefixTreeStrategyFieldTypeDefinition.java
@@ -0,0 +1,51 @@
+package org.apache.blur.analysis.type.spatial;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+import java.util.Map;
+
+import org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy;
+import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
+import org.apache.lucene.spatial.query.SpatialOperation;
+
+import com.spatial4j.core.context.SpatialContext;
+import com.spatial4j.core.io.ShapeReadWriter;
+import com.spatial4j.core.shape.Shape;
+
+public class SpatialRecursivePrefixTreeStrategyFieldTypeDefinition extends BaseSpatialFieldTypeDefinition {
+
+  public static final String NAME = "geo-recursiveprefix";
+
+  @Override
+  public String getName() {
+    return NAME;
+  }
+
+  @Override
+  public void configure(String fieldNameForThisInstance, Map<String, String> properties) {
+    _ctx = SpatialContext.GEO;
+    SpatialPrefixTree grid = getSpatialPrefixTree(properties);
+    _strategy = new RecursivePrefixTreeStrategy(grid, fieldNameForThisInstance);
+    _shapeReadWriter = new ShapeReadWriter<SpatialContext>(_ctx);
+    addSupportedIndexedShapes(Shape.class);
+    addSupportedOperations(SpatialOperation.IsDisjointTo);
+    addSupportedOperations(SpatialOperation.Intersects);
+    addSupportedOperations(SpatialOperation.IsWithin);
+    addSupportedOperations(SpatialOperation.Contains);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition.java b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition.java
new file mode 100644
index 0000000..f7af3a2
--- /dev/null
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition.java
@@ -0,0 +1,47 @@
+package org.apache.blur.analysis.type.spatial;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+import java.util.Map;
+
+import org.apache.lucene.spatial.prefix.TermQueryPrefixTreeStrategy;
+import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
+import org.apache.lucene.spatial.query.SpatialOperation;
+
+import com.spatial4j.core.context.SpatialContext;
+import com.spatial4j.core.io.ShapeReadWriter;
+import com.spatial4j.core.shape.Point;
+
+public class SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition extends BaseSpatialFieldTypeDefinition {
+
+  public static final String NAME = "geo-termprefix";
+
+  @Override
+  public String getName() {
+    return NAME;
+  }
+
+  @Override
+  public void configure(String fieldNameForThisInstance, Map<String, String> properties) {
+    _ctx = SpatialContext.GEO;
+    SpatialPrefixTree grid = getSpatialPrefixTree(properties);
+    _strategy = new TermQueryPrefixTreeStrategy(grid, fieldNameForThisInstance);
+    _shapeReadWriter = new ShapeReadWriter<SpatialContext>(_ctx);
+    addSupportedIndexedShapes(Point.class);
+    addSupportedOperations(SpatialOperation.Intersects);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/089c62c2/blur-query/src/test/java/org/apache/blur/lucene/search/SuperParserTest.java
----------------------------------------------------------------------
diff --git a/blur-query/src/test/java/org/apache/blur/lucene/search/SuperParserTest.java b/blur-query/src/test/java/org/apache/blur/lucene/search/SuperParserTest.java
index 165765c..94726c2 100644
--- a/blur-query/src/test/java/org/apache/blur/lucene/search/SuperParserTest.java
+++ b/blur-query/src/test/java/org/apache/blur/lucene/search/SuperParserTest.java
@@ -68,7 +68,7 @@ public class SuperParserTest {
     fieldManager.addColumnDefinitionDouble("a", "id_d");
     fieldManager.addColumnDefinitionFloat("a", "id_f");
     fieldManager.addColumnDefinitionLong("a", "id_l");
-    fieldManager.addColumnDefinitionGis("a", "id_gis");
+    fieldManager.addColumnDefinitionGisRecursivePrefixTree("a", "id_gis");
     return fieldManager;
   }
 
@@ -329,7 +329,7 @@ public class SuperParserTest {
     int maxLevels = 11;
     SpatialPrefixTree grid = new GeohashPrefixTree(ctx, maxLevels);
     RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, "a.id_gis");
-    Circle circle = ctx.makeCircle(-80.0, 33.0, DistanceUtils.dist2Degrees(200, DistanceUtils.EARTH_MEAN_RADIUS_KM));
+    Circle circle = ctx.makeCircle(-80.0, 33.0, DistanceUtils.dist2Degrees(10, DistanceUtils.EARTH_MEAN_RADIUS_KM));
     SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, circle);
 
     String writeSpatialArgs = SpatialArgsParser.writeSpatialArgs(args, shapeReadWriter);


Mime
View raw message