You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/08/28 13:42:43 UTC

[1/6] git commit: Rewrite testGeo() to test via queries rather than the GeoIndexSearcher thing and re-enable the test (by removing the @Ignore annotation).

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o e7457239d -> 4e428e364


Rewrite testGeo() to test via queries rather than the GeoIndexSearcher thing and re-enable the test (by removing the @Ignore annotation).


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

Branch: refs/heads/two-dot-o
Commit: f22d67a27dd5627d14cec26d935c9c7c8f9fcd61
Parents: e745723
Author: Dave Johnson <dm...@apigee.com>
Authored: Tue Aug 26 15:55:40 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Tue Aug 26 15:55:40 2014 -0400

----------------------------------------------------------------------
 .../org/apache/usergrid/persistence/GeoIT.java  | 94 ++++++++++----------
 1 file changed, 47 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f22d67a2/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java
index 99fef3d..42e5c2b 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java
@@ -24,14 +24,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.AbstractCoreIT;
 import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.persistence.geo.CollectionGeoSearch;
 import org.apache.usergrid.persistence.geo.EntityLocationRef;
 import org.apache.usergrid.persistence.geo.model.Point;
 import org.apache.usergrid.persistence.index.query.Query;
@@ -51,10 +49,6 @@ public class GeoIT extends AbstractCoreIT {
     }
 
 
-    @Ignore // GeoIndexManager and CollectionGeoSearch are no longer needed with Core Persistence
-            // TODO: consider rewriting this test to use queries rather than CollectionGeoSearch
-            // so we can make it work against Core Persistence
-        
     @Test
     public void testGeo() throws Exception {
         LOG.info( "GeoIT.testGeo" );
@@ -65,10 +59,11 @@ public class GeoIT extends AbstractCoreIT {
         EntityManager em = setup.getEmf().getEntityManager( applicationId );
         assertNotNull( em );
 
+        // create user at a location  
         Map<String, Object> properties = new LinkedHashMap<String, Object>() {{
             put( "username", "edanuff" );
             put( "email", "ed@anuff.com" );
-            put( "location.coordinates", new LinkedHashMap<String, Object>() {{
+            put( "location", new LinkedHashMap<String, Object>() {{
                 put("latitude", 37.776753 );
                 put("longitude", -122.407846 );
             }} ); 
@@ -77,48 +72,47 @@ public class GeoIT extends AbstractCoreIT {
         Entity user = em.create( "user", properties );
         assertNotNull( user );
 
-//        GeoIndexManager geo = em.getGeoIndexManager();
-//        geo.storeLocationInCollectionIndex( 
-//                em.getApplicationRef(), "users", user.getUuid(), "location.coordinates", loc );
+        em.refreshIndex();
 
+        // define center point about 300m from that location
         Point center = new Point( 37.774277, -122.404744 );
 
-        CollectionGeoSearch connSearch = new CollectionGeoSearch( 
-                em, setup.getIbl(), setup.getCassSvc(), em.getApplicationRef(), "users" );
-
-
-        List<EntityLocationRef> listResults = connSearch.proximitySearch( 
-                null, null, center, "location.coordinates", 0, 200, 100 ).entityLocations;
+        Query query = Query.fromQL( "select * where location within 200 of " 
+                                    + center.getLat() + "," + center.getLon());
+        Results listResults = em.searchCollection( em.getApplicationRef(), "users", query );
 
-        assertEquals( 0, listResults.size() );
-
-        listResults = connSearch.proximitySearch( 
-                null, null, center, "location.coordinates", 0, 400, 100 ).entityLocations;
+        assertEquals("No results less than 200m away from center", 0, listResults.size() );
 
+        query = Query.fromQL( "select * where location within 400 of " 
+                              + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
 
         this.dump( listResults );
 
-        assertEquals( 1, listResults.size() );
-
-//        geo.removeLocationFromCollectionIndex( 
-//                em.getApplicationRef(), "users", "location.coordinates", loc );
+        assertEquals("1 result less than 400m away from center", 1, listResults.size() );
 
-        properties.remove("location.coordinates");
+        // remove location from user
+        properties.remove("location");
         em.updateProperties(user, properties);
+        em.refreshIndex();
 
-        listResults = connSearch.proximitySearch( 
-                null, null, center, "location.coordinates", 0, 400, 100 ).entityLocations;
+        query = Query.fromQL( "select * where location within 400 of " 
+                              + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
 
         this.dump( listResults );
-
+        
+        // user no longer found with 400m search
         assertEquals( 0, listResults.size() );
 
+        // move user and center to new locations
         updatePos( em, user, 37.426373, -122.14108 );
 
         center = new Point( 37.774277, -122.404744 );
 
-        listResults = connSearch.proximitySearch( 
-                null, null, center, "location.coordinates", 0, 200, 100 ).entityLocations;
+        query = Query.fromQL( "select * where location within 200 of " 
+                                    + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
 
         assertEquals( 0, listResults.size() );
 
@@ -126,50 +120,52 @@ public class GeoIT extends AbstractCoreIT {
 
         center = new Point( 37.776753, -122.407846 );
 
-        listResults = connSearch.proximitySearch( 
-                null, null, center, "location.coordinates", 0, 1000, 100 ).entityLocations;
+        query = Query.fromQL( "select * where location within 1000 of " 
+                                    + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
 
         assertEquals( 1, listResults.size() );
 
         // check at globally large distance
 
-        listResults = connSearch.proximitySearch( 
-            null, null, center, "location.coordinates", 0, Integer.MAX_VALUE, 100 ).entityLocations;
+        query = Query.fromQL( "select * where location within " + Integer.MAX_VALUE + " of " 
+                              + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
 
         assertEquals( 1, listResults.size() );
 
         // create a new entity so we have 2
-        final EntityLocationRef loc2 = new EntityLocationRef( null, 31.1, 121.2 );
         LinkedHashMap<String, Object> properties2 = new LinkedHashMap<String, Object>() {{
             put( "username", "sganyo" );
             put( "email", "sganyo@anuff.com" );
-            put( "location.coordinates", new LinkedHashMap<String, Object>() {{
+            put( "location", new LinkedHashMap<String, Object>() {{
                 put("latitude", 31.1 );
                 put("longitude", 121.2 );
             }} ); 
         }};
         Entity user2 = em.create( "user", properties2 );
+        em.refreshIndex();
         assertNotNull( user2 );
 
-//        geo.storeLocationInCollectionIndex( 
-//                em.getApplicationRef(), "users", user2.getUuid(), "location.coordinates", loc2 );
-
-        listResults = connSearch.proximitySearch( 
-                null, null, center, "location.coordinates", 0, 10000, 100 ).entityLocations;
+        query = Query.fromQL( "select * where location within 10000 of " 
+                                    + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
 
         assertEquals( 1, listResults.size() );
 
         // check at globally large distance
-        listResults = connSearch.proximitySearch( 
-            null, null, center, "location.coordinates", 0, Integer.MAX_VALUE, 100 ).entityLocations;
+        query = Query.fromQL( "select * where location within " + Integer.MAX_VALUE + " of " 
+                              + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
 
         assertEquals( 2, listResults.size() );
 
         // check at globally large distance (center point close to other entity)
         center = new Point( 31.14, 121.27 );
 
-        listResults = connSearch.proximitySearch( 
-            null, null, center, "location.coordinates", 0, Integer.MAX_VALUE, 100 ).entityLocations;
+        query = Query.fromQL( "select * where location within " + Integer.MAX_VALUE + " of " 
+                              + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
 
         assertEquals( 2, listResults.size() );
 
@@ -181,8 +177,9 @@ public class GeoIT extends AbstractCoreIT {
 
         center = new Point( 37.428526, -122.140916 );
 
-        listResults = connSearch.proximitySearch( 
-                null, null, center, "location.coordinates", 0, 1000, 100 ).entityLocations;
+        query = Query.fromQL( "select * where location within 1000 of " 
+                              + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
 
 
         assertEquals( 0, listResults.size() );
@@ -201,6 +198,8 @@ public class GeoIT extends AbstractCoreIT {
 
         em.createConnection( user, "likes", restaurant );
 
+        em.refreshIndex();
+
         emSearchResults = em.searchConnectedEntities( user, 
                 Query.fromQL( "location within 2000 of 37.776753, -122.407846" ) );
         assertEquals( 1, emSearchResults.size() );
@@ -537,6 +536,7 @@ public class GeoIT extends AbstractCoreIT {
         latlong.put( "longitude", longitude );
 
         em.setProperty( entity, "location", latlong );
+        em.refreshIndex();
     }
 
 


[6/6] git commit: Fix for the way that arrays are serialized by JSON and a test to verify that arrays work as expected.

Posted by sn...@apache.org.
Fix for the way that arrays are serialized by JSON and a test to verify that arrays work as expected.


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/4e428e36
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/4e428e36
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/4e428e36

Branch: refs/heads/two-dot-o
Commit: 4e428e364b031d80e6ec1b8cd05f1f148d764a2d
Parents: 9b53e16
Author: Dave Johnson <dm...@apigee.com>
Authored: Wed Aug 27 20:42:04 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Wed Aug 27 20:42:04 2014 -0400

----------------------------------------------------------------------
 .../corepersistence/CpEntityManager.java        |    7 +-
 .../corepersistence/CpEntityMapUtils.java       |    2 +-
 .../corepersistence/CpRelationManager.java      |   26 +-
 .../corepersistence/CpEntityMapUtilsTest.java   |  119 +
 .../persistence/GeoQueryBooleanTest.java        |  178 +
 .../MvccEntitySerializationStrategyImpl.java    |    9 +-
 .../persistence/model/entity/Entity.java        |    2 +-
 .../model/field/value/EntityObject.java         |   12 +-
 stack/corepersistence/pom.xml                   |    2 +-
 .../index/query/tree/CpQueryFilterLexer.java    | 3123 ------------------
 .../index/query/tree/CpQueryFilterParser.java   | 2501 --------------
 11 files changed, 326 insertions(+), 5655 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e428e36/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index 2ce3d56..28124c2 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -2486,12 +2486,13 @@ public class CpEntityManager implements EntityManager {
         EntityCollectionManager ecm = managerCache.getEntityCollectionManager( collectionScope );
 
         if ( logger.isDebugEnabled() ) {
-            logger.debug( "Writing entity {}:{} into scope\n   app {}\n   owner {}\n   name {}", 
+            logger.debug( "Writing entity {}:{} into scope\n   app {}\n   owner {}\n   name {} data {}", 
                 new Object[] {
                     entity.getType(), entity.getUuid(), 
                     collectionScope.getApplication(), 
                     collectionScope.getOwner(),
-                    collectionScope.getName()
+                    collectionScope.getName(),
+                    CpEntityMapUtils.toMap(cpEntity)
             } );
 //
 //            if ( entity.getType().equals("group")) {
@@ -2750,7 +2751,7 @@ public class CpEntityManager implements EntityManager {
     }
 
 
-    private org.apache.usergrid.persistence.model.entity.Entity entityToCpEntity( Entity entity, UUID importId ) {
+    public static org.apache.usergrid.persistence.model.entity.Entity entityToCpEntity( Entity entity, UUID importId ) {
 
         UUID uuid = importId != null ? importId : entity.getUuid();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e428e36/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityMapUtils.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityMapUtils.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityMapUtils.java
index 560f283..18eb7f9 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityMapUtils.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityMapUtils.java
@@ -59,7 +59,7 @@ import org.slf4j.LoggerFactory;
  * Utilities for converting entities to/from maps suitable for Core Persistence.
  * Aware of unique properties via Schema.
  */
-class CpEntityMapUtils {
+public class CpEntityMapUtils {
     private static final Logger logger = LoggerFactory.getLogger( CpEntityMapUtils.class );
 
     public static ObjectMapper objectMapper = new ObjectMapper(  );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e428e36/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
index d467682..31d32dd 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
@@ -650,7 +650,6 @@ public class CpRelationManager implements RelationManager {
             return null;
         }
 
-
         // load the new member entity to be added to the collection from its default scope
         CollectionScope memberScope = new CollectionScopeImpl( 
             applicationScope.getApplication(), 
@@ -658,28 +657,29 @@ public class CpRelationManager implements RelationManager {
             CpEntityManager.getCollectionScopeNameFromEntityType( itemRef.getType()));
         EntityCollectionManager memberMgr = managerCache.getEntityCollectionManager(memberScope);
 
+        org.apache.usergrid.persistence.model.entity.Entity memberEntity = memberMgr.load(
+            new SimpleId( itemRef.getUuid(), itemRef.getType() )).toBlockingObservable().last();
+
+        if ( memberEntity == null ) {
+            throw new RuntimeException("Unable to load entity uuid=" 
+                + itemRef.getUuid() + " type=" + itemRef.getType());
+        }
+
         if ( logger.isDebugEnabled() ) {
-            logger.debug("Loading member entity {}:{} from scope\n   app {}\n   owner {}\n   name {}", 
+            logger.debug("Loaded member entity {}:{} from scope\n   app {}\n   owner {}\n   name {} data {}", 
                 new Object[] { 
                     itemRef.getType(), 
                     itemRef.getUuid(), 
                     memberScope.getApplication(), 
                     memberScope.getOwner(), 
-                    memberScope.getName() 
+                    memberScope.getName(),
+                    CpEntityMapUtils.toMap(memberEntity)
             });
         }
 
-        org.apache.usergrid.persistence.model.entity.Entity memberEntity = memberMgr.load(
-            new SimpleId( itemRef.getUuid(), itemRef.getType() )).toBlockingObservable().last();
-
-        if ( memberEntity == null ) {
-            throw new RuntimeException("Unable to load entity uuid=" 
-                + itemRef.getUuid() + " type=" + itemRef.getType());
-        }
-
         String edgeType = getEdgeTypeFromCollectionName( collName, memberEntity.getId().getType() );
 
-        logger.debug("createCollection(): Creating edge type {} from {}:{} to {}:{}", 
+        logger.debug("addToCollection(): Creating edge type {} from {}:{} to {}:{}", 
             new Object[] { 
                 edgeType, 
                 headEntity.getType(), headEntity.getUuid(), 
@@ -694,7 +694,7 @@ public class CpRelationManager implements RelationManager {
         GraphManager gm = managerCache.getGraphManager(applicationScope);
         gm.writeEdge(edge).toBlockingObservable().last();
 
-        // index member into entity connection | type scope
+        // index member into entity collection | type scope
         IndexScope collectionIndexScope = new IndexScopeImpl(
             applicationScope.getApplication(), 
             cpHeadEntity.getId(), 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e428e36/stack/core/src/test/java/org/apache/usergrid/corepersistence/CpEntityMapUtilsTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/CpEntityMapUtilsTest.java b/stack/core/src/test/java/org/apache/usergrid/corepersistence/CpEntityMapUtilsTest.java
new file mode 100644
index 0000000..87f6b46
--- /dev/null
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/CpEntityMapUtilsTest.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2014 The Apache Software Foundation.
+ *
+ * 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.apache.usergrid.corepersistence;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.usergrid.persistence.model.entity.Entity;
+import org.apache.usergrid.persistence.model.entity.SimpleId;
+import org.apache.usergrid.persistence.model.field.ListField;
+import org.apache.usergrid.persistence.model.field.value.EntityObject;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class CpEntityMapUtilsTest {
+    private static final Logger log = LoggerFactory.getLogger( CpEntityMapUtilsTest.class );
+
+    @Test
+    public void testToMap() {
+
+        Map<String, Object> properties = new LinkedHashMap<String, Object>() {{
+            put( "username", "bart" );
+            put( "email", "bart@example.com" );
+            put( "block", new ArrayList<Object>() {{
+                add( new LinkedHashMap<String, Object>() {{ put("name", "fred"); }});
+                add( new LinkedHashMap<String, Object>() {{ put("name", "gertrude"); }});
+                add( new LinkedHashMap<String, Object>() {{ put("name", "mina"); }});
+            }});            
+            put( "blockedBy", new ArrayList<Object>() {{
+                add( new LinkedHashMap<String, Object>() {{ put("name", "isabell"); }});
+            }});
+            put( "location", new LinkedHashMap<String, Object>() {{
+                put("latitude", 37.776753 );
+                put("longitude", -122.407846 );
+            }}); 
+        }};
+
+        Entity cpEntity = CpEntityMapUtils.fromMap( properties, "user", true );
+        assertUserWithBlocks( cpEntity );
+    }
+
+        
+    @Test
+    public void testSerialization() throws JsonProcessingException, IOException {
+
+        Map<String, Object> properties = new LinkedHashMap<String, Object>() {{
+            put( "username", "bart" );
+            put( "email", "bart@example.com" );
+            put( "block", new ArrayList<Object>() {{
+                add( new LinkedHashMap<String, Object>() {{ put("name", "fred"); }});
+                add( new LinkedHashMap<String, Object>() {{ put("name", "gertrude"); }});
+                add( new LinkedHashMap<String, Object>() {{ put("name", "mina"); }});
+            }});            
+            put( "blockedBy", new ArrayList<Object>() {{
+                add( new LinkedHashMap<String, Object>() {{ put("name", "isabell"); }});
+            }});
+            put( "location", new LinkedHashMap<String, Object>() {{
+                put("latitude", 37.776753 );
+                put("longitude", -122.407846 );
+            }}); 
+        }};
+
+        org.apache.usergrid.persistence.model.entity.Entity entity = 
+            new org.apache.usergrid.persistence.model.entity.Entity(
+                new SimpleId( "user" ) );
+        entity = CpEntityMapUtils.fromMap( entity, properties, null, true );
+
+        assertUserWithBlocks( entity );
+
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.enable(SerializationFeature.INDENT_OUTPUT);
+        mapper.enableDefaultTypingAsProperty(ObjectMapper.DefaultTyping.JAVA_LANG_OBJECT, "@class");
+
+        String entityString = mapper.writeValueAsString( entity );
+        //log.debug("Serialized to JSON: " + entityString );
+
+        TypeReference<Entity> tr = new TypeReference<Entity>() {};
+        entity = mapper.readValue( entityString, tr );
+        //log.debug("Round-tripped entity: " + CpEntityMapUtils.toMap(entity) );
+
+        assertUserWithBlocks( entity );
+    }
+
+
+    private void assertUserWithBlocks( org.apache.usergrid.persistence.model.entity.Entity e ) {
+        
+        assertTrue( e.getField("block") instanceof ListField );
+        assertTrue( e.getField("block").getValue() instanceof List );
+        List blockList = (List)e.getField("block").getValue();
+
+        EntityObject entityObject = (EntityObject)blockList.get(0);
+        assertEquals("fred", entityObject.getField("name").getValue());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e428e36/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryBooleanTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryBooleanTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryBooleanTest.java
new file mode 100644
index 0000000..8767a70
--- /dev/null
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryBooleanTest.java
@@ -0,0 +1,178 @@
+/*
+ * 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.
+ */
+package org.apache.usergrid.persistence;
+
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.inject.Injector;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.AbstractCoreIT;
+import org.apache.usergrid.cassandra.Concurrent;
+import org.apache.usergrid.corepersistence.CpEntityMapUtils;
+import org.apache.usergrid.corepersistence.CpSetup;
+import org.apache.usergrid.persistence.collection.CollectionScope;
+import org.apache.usergrid.persistence.collection.EntityCollectionManager;
+import org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory;
+import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
+import org.apache.usergrid.persistence.geo.model.Point;
+import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.model.entity.SimpleId;
+import org.apache.usergrid.persistence.model.field.ListField;
+import org.apache.usergrid.persistence.model.field.value.EntityObject;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+
+@Concurrent()
+public class GeoQueryBooleanTest extends AbstractCoreIT {
+    private static final Logger log = LoggerFactory.getLogger( GeoQueryBooleanTest.class );
+
+
+    public GeoQueryBooleanTest() {
+        super();
+    }
+
+
+    @Test
+    public void testGeoQueryWithOr() throws Exception {
+
+        log.info( "GeoQueryBooleanTest.testGeoQueryWithOr" );
+
+        UUID applicationId = setup.createApplication( "testOrganization", "testGeoQueryWithOr" );
+        assertNotNull( applicationId );
+
+        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        assertNotNull( em );
+
+        // create two users at a location
+
+        Map<String, Object> properties = new LinkedHashMap<String, Object>() {{
+            put( "username", "ed" );
+            put( "employer", "Apigee" );
+            put( "email", "ed@example.com" );
+            put( "location", new LinkedHashMap<String, Object>() {{
+                put("latitude", 37.776753 );
+                put("longitude", -122.407846 );
+            }} ); 
+        }};
+
+        Entity user1 = em.create( "user", properties );
+        assertNotNull( user1 );
+
+        properties = new LinkedHashMap<String, Object>() {{
+            put( "username", "fred" );
+            put( "employer", "Microsoft" );
+            put( "email", "fred@example.com" );
+            put( "location", new LinkedHashMap<String, Object>() {{
+                put("latitude", 37.776753 );
+                put("longitude", -122.407846 );
+            }} ); 
+        }};
+
+        Entity user2 = em.create( "user", properties );
+        assertNotNull( user2 );
+
+        em.refreshIndex();
+
+        // define center point about 300m from that location
+        Point center = new Point( 37.774277, -122.404744 );
+
+        Query query = Query.fromQL( "select * where location within 400 of " 
+                                    + center.getLat() + "," + center.getLon());
+        Results listResults = em.searchCollection( em.getApplicationRef(), "users", query );
+        assertEquals( 2, listResults.size() );
+
+        query = Query.fromQL( "select * where employer='Apigee' or location within 100 of " 
+                                    + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
+
+        // no results because geo filter applied after query even in the case or 'or'
+        assertEquals( 0, listResults.size() );
+
+        query = Query.fromQL( "select * where employer='Apigee' or location within 400 of " 
+                                    + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
+
+        // only one result because geo filter applied after query even in the case or 'or'
+        assertEquals( 1, listResults.size() );
+    }
+
+
+    @Test
+    public void testGeoQueryWithNot() throws Exception {
+
+        log.info( "GeoQueryBooleanTest.testGeoQueryWithOr" );
+
+        UUID applicationId = setup.createApplication( "testOrganization", "testGeoQueryWithOr" );
+        assertNotNull( applicationId );
+
+        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        assertNotNull( em );
+
+        Map<String, Object> properties = new LinkedHashMap<String, Object>() {{
+            put( "username", "bart" );
+            put( "email", "bart@example.com" );
+            put( "block", new ArrayList<Object>() {{
+                add( new LinkedHashMap<String, Object>() {{ put("name", "fred"); }});
+                add( new LinkedHashMap<String, Object>() {{ put("name", "gertrude"); }});
+                add( new LinkedHashMap<String, Object>() {{ put("name", "mina"); }});
+            }});            
+            put( "blockedBy", new ArrayList<Object>() {{
+                add( new LinkedHashMap<String, Object>() {{ put("name", "isabell"); }});
+            }});
+            put( "location", new LinkedHashMap<String, Object>() {{
+                put("latitude", 37.776753 );
+                put("longitude", -122.407846 );
+            }}); 
+        }};
+
+        Entity userBart = em.create( "user", properties );
+        assertNotNull( userBart );
+//
+//        properties = new LinkedHashMap<String, Object>() {{
+//            put( "username", "fred" );
+//            put( "email", "fred@example.com" );
+//            put( "block", new ArrayList<Object>() {{
+//                add( new LinkedHashMap<String, Object>() {{ put("name", "steve"); }});
+//                add( new LinkedHashMap<String, Object>() {{ put("name", "mina"); }});
+//            }});
+//            put( "blockedBy", new ArrayList<Object>() {{
+//                add( new LinkedHashMap<String, Object>() {{ put("name", "bart"); }});
+//            }});
+//            put( "location", new LinkedHashMap<String, Object>() {{
+//                put("latitude", 37.776753 );
+//                put("longitude", -122.407846 );
+//            }} ); 
+//        }};
+//
+//        Entity userFred = em.create( "user", properties );
+//        assertNotNull( userFred );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e428e36/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
index cbc1c8c..4f8d1f3 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
@@ -366,9 +366,8 @@ public class MvccEntitySerializationStrategyImpl implements MvccEntitySerializat
 
             byte[] state = parser.read( BYTES_ARRAY_SERIALIZER );
 
-            /**
-             * It's been deleted, remove it
-             */
+            // it's been deleted, remove it
+
             if ( Arrays.equals( STATE_DELETED, state ) ) {
                 return new EntityWrapper( MvccEntity.Status.COMPLETE, Optional.<Entity>absent() );
             }
@@ -381,7 +380,7 @@ public class MvccEntitySerializationStrategyImpl implements MvccEntitySerializat
             int length = jsonBytes.remaining();
 
             try {
-                storedEntity = mapper.readValue( array,start,length,Entity.class);
+                storedEntity = mapper.readValue( array, start, length, Entity.class );
             }
             catch ( Exception e ) {
                 throw new RuntimeException(e.getMessage());
@@ -393,7 +392,7 @@ public class MvccEntitySerializationStrategyImpl implements MvccEntitySerializat
                 return new EntityWrapper( MvccEntity.Status.COMPLETE, entity );
             }
 
-            //it's partial by default
+            // it's partial by default
             return new EntityWrapper( MvccEntity.Status.PARTIAL, entity );
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e428e36/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/Entity.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/Entity.java b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/Entity.java
index 4287626..c5089dc 100644
--- a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/Entity.java
+++ b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/entity/Entity.java
@@ -34,7 +34,7 @@ import com.google.common.base.Preconditions;
  * Equality is based both on id an on version.
  */
 @JsonIgnoreProperties(ignoreUnknown = true)
-@JsonTypeInfo( use= JsonTypeInfo.Id.CLASS,include= JsonTypeInfo.As.WRAPPER_OBJECT,property="@class" )
+@JsonTypeInfo( use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class" )
 public class Entity extends EntityObject {
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e428e36/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/value/EntityObject.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/value/EntityObject.java b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/value/EntityObject.java
index 2443776..12915e2 100644
--- a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/value/EntityObject.java
+++ b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/value/EntityObject.java
@@ -41,7 +41,7 @@ public class EntityObject implements Serializable {
     /**
      * Fields the users can set
      */
-    @JsonTypeInfo( use= JsonTypeInfo.Id.CLASS,include= JsonTypeInfo.As.WRAPPER_OBJECT,property="@class" )
+    @JsonTypeInfo( use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class" )
     private final Map<String, Field> fields = new HashMap<String, Field>();
 
     /**
@@ -66,12 +66,14 @@ public class EntityObject implements Serializable {
 
     //@JsonAnySetter
     public void setFields(ArrayList al) {
-        if(al.size() == 0)
+
+        if ( al.isEmpty()) {
             return;
+        }
 
         for(int i = 0; i < al.size(); i++) {
             String str = al.get( i ).toString();
-            if(str.contains( "version" )){
+            if ( str.contains( "version" )) {
                 continue;
             }
             Field fd = ( Field ) al.get( i );
@@ -79,10 +81,6 @@ public class EntityObject implements Serializable {
         }
     }
 
-
-    public void getFields( String name) {
-        fields.get( name );
-    }
     /**
      * Get all fields in the entity
      */

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e428e36/stack/corepersistence/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/pom.xml b/stack/corepersistence/pom.xml
index 5a5c20c..7dad18c 100644
--- a/stack/corepersistence/pom.xml
+++ b/stack/corepersistence/pom.xml
@@ -94,7 +94,7 @@
                     <systemPropertyVariables>
                         <archaius.deployment.environment>UNIT</archaius.deployment.environment>
                     </systemPropertyVariables>
-                    <argLine>-Xms2G -Xmx4G</argLine>
+                    <argLine>-Xms2G -Xmx4G -Dlog4j.debug=true -Dlog4j.configuration=file://${project.basedir}/src/test/resources/log4j.properties</argLine>
                 </configuration>
             </plugin>
 


[4/6] Fix for the way that arrays are serialized by JSON and a test to verify that arrays work as expected.

Posted by sn...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e428e36/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/query/tree/CpQueryFilterParser.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/query/tree/CpQueryFilterParser.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/query/tree/CpQueryFilterParser.java
deleted file mode 100644
index 4693754..0000000
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/query/tree/CpQueryFilterParser.java
+++ /dev/null
@@ -1,2501 +0,0 @@
-// $ANTLR 3.4 org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g 2014-08-25 10:56:14
-
-/*
- * 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.
- */
-
-package org.apache.usergrid.persistence.index.query.tree;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.usergrid.persistence.index.query.Query;
-import org.apache.usergrid.persistence.index.query.Query.SortPredicate;
-
-
-
-import org.antlr.runtime.*;
-import java.util.Stack;
-import java.util.List;
-import java.util.ArrayList;
-
-import org.antlr.runtime.tree.*;
-
-
-@SuppressWarnings({"all", "warnings", "unchecked"})
-public class CpQueryFilterParser extends Parser {
-    public static final String[] tokenNames = new String[] {
-        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "AND", "ASC", "BOOLEAN", "CONTAINS", "DESC", "EQ", "ESC_SEQ", "EXPONENT", "FALSE", "FLOAT", "GT", "GTE", "HEX_DIGIT", "ID", "LONG", "LT", "LTE", "NOT", "OCTAL_ESC", "OF", "OR", "STRING", "TRUE", "UNICODE_ESC", "UUID", "WITHIN", "WS", "'('", "')'", "'*'", "','", "':'", "'order by'", "'select'", "'where'", "'{'", "'}'"
-    };
-
-    public static final int EOF=-1;
-    public static final int T__31=31;
-    public static final int T__32=32;
-    public static final int T__33=33;
-    public static final int T__34=34;
-    public static final int T__35=35;
-    public static final int T__36=36;
-    public static final int T__37=37;
-    public static final int T__38=38;
-    public static final int T__39=39;
-    public static final int T__40=40;
-    public static final int AND=4;
-    public static final int ASC=5;
-    public static final int BOOLEAN=6;
-    public static final int CONTAINS=7;
-    public static final int DESC=8;
-    public static final int EQ=9;
-    public static final int ESC_SEQ=10;
-    public static final int EXPONENT=11;
-    public static final int FALSE=12;
-    public static final int FLOAT=13;
-    public static final int GT=14;
-    public static final int GTE=15;
-    public static final int HEX_DIGIT=16;
-    public static final int ID=17;
-    public static final int LONG=18;
-    public static final int LT=19;
-    public static final int LTE=20;
-    public static final int NOT=21;
-    public static final int OCTAL_ESC=22;
-    public static final int OF=23;
-    public static final int OR=24;
-    public static final int STRING=25;
-    public static final int TRUE=26;
-    public static final int UNICODE_ESC=27;
-    public static final int UUID=28;
-    public static final int WITHIN=29;
-    public static final int WS=30;
-
-    // delegates
-    public Parser[] getDelegates() {
-        return new Parser[] {};
-    }
-
-    // delegators
-
-
-    public CpQueryFilterParser(TokenStream input) {
-        this(input, new RecognizerSharedState());
-    }
-    public CpQueryFilterParser(TokenStream input, RecognizerSharedState state) {
-        super(input, state);
-    }
-
-protected TreeAdaptor adaptor = new CommonTreeAdaptor();
-
-public void setTreeAdaptor(TreeAdaptor adaptor) {
-    this.adaptor = adaptor;
-}
-public TreeAdaptor getTreeAdaptor() {
-    return adaptor;
-}
-    public String[] getTokenNames() { return CpQueryFilterParser.tokenNames; }
-    public String getGrammarFileName() { return "org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g"; }
-
-
-    	Query query = new Query();
-
-      private static final Logger logger = LoggerFactory
-          .getLogger(CpQueryFilterLexer.class);
-
-    	@Override
-    	public void emitErrorMessage(String msg) {
-    		logger.info(msg);
-    	}
-
-
-    public static class property_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "property"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:209:1: property : ID ;
-    public final CpQueryFilterParser.property_return property() throws RecognitionException {
-        CpQueryFilterParser.property_return retval = new CpQueryFilterParser.property_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token ID1=null;
-
-        Object ID1_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:209:10: ( ID )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:209:12: ID
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            ID1=(Token)match(input,ID,FOLLOW_ID_in_property991); 
-            ID1_tree = 
-            new Property(ID1) 
-            ;
-            adaptor.addChild(root_0, ID1_tree);
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "property"
-
-
-    public static class containsproperty_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "containsproperty"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:211:1: containsproperty : ID ;
-    public final CpQueryFilterParser.containsproperty_return containsproperty() throws RecognitionException {
-        CpQueryFilterParser.containsproperty_return retval = new CpQueryFilterParser.containsproperty_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token ID2=null;
-
-        Object ID2_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:211:18: ( ID )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:211:20: ID
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            ID2=(Token)match(input,ID,FOLLOW_ID_in_containsproperty1002); 
-            ID2_tree = 
-            new ContainsProperty(ID2) 
-            ;
-            adaptor.addChild(root_0, ID2_tree);
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "containsproperty"
-
-
-    public static class withinproperty_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "withinproperty"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:213:1: withinproperty : ID ;
-    public final CpQueryFilterParser.withinproperty_return withinproperty() throws RecognitionException {
-        CpQueryFilterParser.withinproperty_return retval = new CpQueryFilterParser.withinproperty_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token ID3=null;
-
-        Object ID3_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:213:16: ( ID )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:213:18: ID
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            ID3=(Token)match(input,ID,FOLLOW_ID_in_withinproperty1013); 
-            ID3_tree = 
-            new WithinProperty(ID3) 
-            ;
-            adaptor.addChild(root_0, ID3_tree);
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "withinproperty"
-
-
-    public static class booleanliteral_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "booleanliteral"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:215:1: booleanliteral : BOOLEAN ;
-    public final CpQueryFilterParser.booleanliteral_return booleanliteral() throws RecognitionException {
-        CpQueryFilterParser.booleanliteral_return retval = new CpQueryFilterParser.booleanliteral_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token BOOLEAN4=null;
-
-        Object BOOLEAN4_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:215:15: ( BOOLEAN )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:215:17: BOOLEAN
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            BOOLEAN4=(Token)match(input,BOOLEAN,FOLLOW_BOOLEAN_in_booleanliteral1024); 
-            BOOLEAN4_tree = 
-            new BooleanLiteral(BOOLEAN4) 
-            ;
-            adaptor.addChild(root_0, BOOLEAN4_tree);
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "booleanliteral"
-
-
-    public static class longliteral_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "longliteral"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:218:1: longliteral : LONG ;
-    public final CpQueryFilterParser.longliteral_return longliteral() throws RecognitionException {
-        CpQueryFilterParser.longliteral_return retval = new CpQueryFilterParser.longliteral_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token LONG5=null;
-
-        Object LONG5_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:218:13: ( LONG )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:219:3: LONG
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            LONG5=(Token)match(input,LONG,FOLLOW_LONG_in_longliteral1038); 
-            LONG5_tree = 
-            new LongLiteral(LONG5) 
-            ;
-            adaptor.addChild(root_0, LONG5_tree);
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "longliteral"
-
-
-    public static class uuidliteral_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "uuidliteral"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:221:1: uuidliteral : UUID ;
-    public final CpQueryFilterParser.uuidliteral_return uuidliteral() throws RecognitionException {
-        CpQueryFilterParser.uuidliteral_return retval = new CpQueryFilterParser.uuidliteral_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token UUID6=null;
-
-        Object UUID6_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:221:13: ( UUID )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:222:3: UUID
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            UUID6=(Token)match(input,UUID,FOLLOW_UUID_in_uuidliteral1052); 
-            UUID6_tree = 
-            new UUIDLiteral(UUID6) 
-            ;
-            adaptor.addChild(root_0, UUID6_tree);
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "uuidliteral"
-
-
-    public static class stringliteral_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "stringliteral"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:224:1: stringliteral : STRING ;
-    public final CpQueryFilterParser.stringliteral_return stringliteral() throws RecognitionException {
-        CpQueryFilterParser.stringliteral_return retval = new CpQueryFilterParser.stringliteral_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token STRING7=null;
-
-        Object STRING7_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:224:15: ( STRING )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:225:3: STRING
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            STRING7=(Token)match(input,STRING,FOLLOW_STRING_in_stringliteral1065); 
-            STRING7_tree = 
-            new StringLiteral(STRING7) 
-            ;
-            adaptor.addChild(root_0, STRING7_tree);
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "stringliteral"
-
-
-    public static class floatliteral_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "floatliteral"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:227:1: floatliteral : FLOAT ;
-    public final CpQueryFilterParser.floatliteral_return floatliteral() throws RecognitionException {
-        CpQueryFilterParser.floatliteral_return retval = new CpQueryFilterParser.floatliteral_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token FLOAT8=null;
-
-        Object FLOAT8_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:227:14: ( FLOAT )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:228:3: FLOAT
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            FLOAT8=(Token)match(input,FLOAT,FOLLOW_FLOAT_in_floatliteral1080); 
-            FLOAT8_tree = 
-            new FloatLiteral(FLOAT8) 
-            ;
-            adaptor.addChild(root_0, FLOAT8_tree);
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "floatliteral"
-
-
-    public static class value_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "value"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:231:1: value : ( booleanliteral | longliteral | uuidliteral | stringliteral | floatliteral );
-    public final CpQueryFilterParser.value_return value() throws RecognitionException {
-        CpQueryFilterParser.value_return retval = new CpQueryFilterParser.value_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        CpQueryFilterParser.booleanliteral_return booleanliteral9 =null;
-
-        CpQueryFilterParser.longliteral_return longliteral10 =null;
-
-        CpQueryFilterParser.uuidliteral_return uuidliteral11 =null;
-
-        CpQueryFilterParser.stringliteral_return stringliteral12 =null;
-
-        CpQueryFilterParser.floatliteral_return floatliteral13 =null;
-
-
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:231:7: ( booleanliteral | longliteral | uuidliteral | stringliteral | floatliteral )
-            int alt1=5;
-            switch ( input.LA(1) ) {
-            case BOOLEAN:
-                {
-                alt1=1;
-                }
-                break;
-            case LONG:
-                {
-                alt1=2;
-                }
-                break;
-            case UUID:
-                {
-                alt1=3;
-                }
-                break;
-            case STRING:
-                {
-                alt1=4;
-                }
-                break;
-            case FLOAT:
-                {
-                alt1=5;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 1, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt1) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:232:3: booleanliteral
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_booleanliteral_in_value1096);
-                    booleanliteral9=booleanliteral();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, booleanliteral9.getTree());
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:233:5: longliteral
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_longliteral_in_value1102);
-                    longliteral10=longliteral();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, longliteral10.getTree());
-
-                    }
-                    break;
-                case 3 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:234:5: uuidliteral
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_uuidliteral_in_value1108);
-                    uuidliteral11=uuidliteral();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, uuidliteral11.getTree());
-
-                    }
-                    break;
-                case 4 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:235:5: stringliteral
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_stringliteral_in_value1114);
-                    stringliteral12=stringliteral();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, stringliteral12.getTree());
-
-                    }
-                    break;
-                case 5 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:236:5: floatliteral
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_floatliteral_in_value1120);
-                    floatliteral13=floatliteral();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, floatliteral13.getTree());
-
-                    }
-                    break;
-
-            }
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "value"
-
-
-    public static class equalityop_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "equalityop"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:247:1: equalityop : ( property LT ^ value | property LTE ^ value | property EQ ^ value | property GT ^ value | property GTE ^ value );
-    public final CpQueryFilterParser.equalityop_return equalityop() throws RecognitionException {
-        CpQueryFilterParser.equalityop_return retval = new CpQueryFilterParser.equalityop_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token LT15=null;
-        Token LTE18=null;
-        Token EQ21=null;
-        Token GT24=null;
-        Token GTE27=null;
-        CpQueryFilterParser.property_return property14 =null;
-
-        CpQueryFilterParser.value_return value16 =null;
-
-        CpQueryFilterParser.property_return property17 =null;
-
-        CpQueryFilterParser.value_return value19 =null;
-
-        CpQueryFilterParser.property_return property20 =null;
-
-        CpQueryFilterParser.value_return value22 =null;
-
-        CpQueryFilterParser.property_return property23 =null;
-
-        CpQueryFilterParser.value_return value25 =null;
-
-        CpQueryFilterParser.property_return property26 =null;
-
-        CpQueryFilterParser.value_return value28 =null;
-
-
-        Object LT15_tree=null;
-        Object LTE18_tree=null;
-        Object EQ21_tree=null;
-        Object GT24_tree=null;
-        Object GTE27_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:247:12: ( property LT ^ value | property LTE ^ value | property EQ ^ value | property GT ^ value | property GTE ^ value )
-            int alt2=5;
-            switch ( input.LA(1) ) {
-            case ID:
-                {
-                switch ( input.LA(2) ) {
-                case LT:
-                    {
-                    alt2=1;
-                    }
-                    break;
-                case LTE:
-                    {
-                    alt2=2;
-                    }
-                    break;
-                case EQ:
-                    {
-                    alt2=3;
-                    }
-                    break;
-                case GT:
-                    {
-                    alt2=4;
-                    }
-                    break;
-                case GTE:
-                    {
-                    alt2=5;
-                    }
-                    break;
-                default:
-                    NoViableAltException nvae =
-                        new NoViableAltException("", 2, 1, input);
-
-                    throw nvae;
-
-                }
-
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 2, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt2) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:248:3: property LT ^ value
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_property_in_equalityop1145);
-                    property14=property();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, property14.getTree());
-
-                    LT15=(Token)match(input,LT,FOLLOW_LT_in_equalityop1147); 
-                    LT15_tree = 
-                    new LessThan(LT15) 
-                    ;
-                    root_0 = (Object)adaptor.becomeRoot(LT15_tree, root_0);
-
-
-                    pushFollow(FOLLOW_value_in_equalityop1153);
-                    value16=value();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, value16.getTree());
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:249:4: property LTE ^ value
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_property_in_equalityop1158);
-                    property17=property();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, property17.getTree());
-
-                    LTE18=(Token)match(input,LTE,FOLLOW_LTE_in_equalityop1160); 
-                    LTE18_tree = 
-                    new LessThanEqual(LTE18) 
-                    ;
-                    root_0 = (Object)adaptor.becomeRoot(LTE18_tree, root_0);
-
-
-                    pushFollow(FOLLOW_value_in_equalityop1166);
-                    value19=value();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, value19.getTree());
-
-                    }
-                    break;
-                case 3 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:250:4: property EQ ^ value
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_property_in_equalityop1171);
-                    property20=property();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, property20.getTree());
-
-                    EQ21=(Token)match(input,EQ,FOLLOW_EQ_in_equalityop1173); 
-                    EQ21_tree = 
-                    new Equal(EQ21) 
-                    ;
-                    root_0 = (Object)adaptor.becomeRoot(EQ21_tree, root_0);
-
-
-                    pushFollow(FOLLOW_value_in_equalityop1179);
-                    value22=value();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, value22.getTree());
-
-                    }
-                    break;
-                case 4 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:251:4: property GT ^ value
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_property_in_equalityop1184);
-                    property23=property();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, property23.getTree());
-
-                    GT24=(Token)match(input,GT,FOLLOW_GT_in_equalityop1186); 
-                    GT24_tree = 
-                    new GreaterThan(GT24) 
-                    ;
-                    root_0 = (Object)adaptor.becomeRoot(GT24_tree, root_0);
-
-
-                    pushFollow(FOLLOW_value_in_equalityop1192);
-                    value25=value();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, value25.getTree());
-
-                    }
-                    break;
-                case 5 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:252:4: property GTE ^ value
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_property_in_equalityop1197);
-                    property26=property();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, property26.getTree());
-
-                    GTE27=(Token)match(input,GTE,FOLLOW_GTE_in_equalityop1199); 
-                    GTE27_tree = 
-                    new GreaterThanEqual(GTE27) 
-                    ;
-                    root_0 = (Object)adaptor.becomeRoot(GTE27_tree, root_0);
-
-
-                    pushFollow(FOLLOW_value_in_equalityop1205);
-                    value28=value();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, value28.getTree());
-
-                    }
-                    break;
-
-            }
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "equalityop"
-
-
-    public static class locationop_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "locationop"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:256:1: locationop : withinproperty WITHIN ^ ( floatliteral | longliteral ) OF ! ( floatliteral | longliteral ) ',' ! ( floatliteral | longliteral ) ;
-    public final CpQueryFilterParser.locationop_return locationop() throws RecognitionException {
-        CpQueryFilterParser.locationop_return retval = new CpQueryFilterParser.locationop_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token WITHIN30=null;
-        Token OF33=null;
-        Token char_literal36=null;
-        CpQueryFilterParser.withinproperty_return withinproperty29 =null;
-
-        CpQueryFilterParser.floatliteral_return floatliteral31 =null;
-
-        CpQueryFilterParser.longliteral_return longliteral32 =null;
-
-        CpQueryFilterParser.floatliteral_return floatliteral34 =null;
-
-        CpQueryFilterParser.longliteral_return longliteral35 =null;
-
-        CpQueryFilterParser.floatliteral_return floatliteral37 =null;
-
-        CpQueryFilterParser.longliteral_return longliteral38 =null;
-
-
-        Object WITHIN30_tree=null;
-        Object OF33_tree=null;
-        Object char_literal36_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:256:12: ( withinproperty WITHIN ^ ( floatliteral | longliteral ) OF ! ( floatliteral | longliteral ) ',' ! ( floatliteral | longliteral ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:257:3: withinproperty WITHIN ^ ( floatliteral | longliteral ) OF ! ( floatliteral | longliteral ) ',' ! ( floatliteral | longliteral )
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            pushFollow(FOLLOW_withinproperty_in_locationop1220);
-            withinproperty29=withinproperty();
-
-            state._fsp--;
-
-            adaptor.addChild(root_0, withinproperty29.getTree());
-
-            WITHIN30=(Token)match(input,WITHIN,FOLLOW_WITHIN_in_locationop1222); 
-            WITHIN30_tree = 
-            new WithinOperand(WITHIN30) 
-            ;
-            root_0 = (Object)adaptor.becomeRoot(WITHIN30_tree, root_0);
-
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:257:41: ( floatliteral | longliteral )
-            int alt3=2;
-            switch ( input.LA(1) ) {
-            case FLOAT:
-                {
-                alt3=1;
-                }
-                break;
-            case LONG:
-                {
-                alt3=2;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 3, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt3) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:257:42: floatliteral
-                    {
-                    pushFollow(FOLLOW_floatliteral_in_locationop1229);
-                    floatliteral31=floatliteral();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, floatliteral31.getTree());
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:257:55: longliteral
-                    {
-                    pushFollow(FOLLOW_longliteral_in_locationop1231);
-                    longliteral32=longliteral();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, longliteral32.getTree());
-
-                    }
-                    break;
-
-            }
-
-
-            OF33=(Token)match(input,OF,FOLLOW_OF_in_locationop1234); 
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:257:72: ( floatliteral | longliteral )
-            int alt4=2;
-            switch ( input.LA(1) ) {
-            case FLOAT:
-                {
-                alt4=1;
-                }
-                break;
-            case LONG:
-                {
-                alt4=2;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 4, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt4) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:257:73: floatliteral
-                    {
-                    pushFollow(FOLLOW_floatliteral_in_locationop1238);
-                    floatliteral34=floatliteral();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, floatliteral34.getTree());
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:257:86: longliteral
-                    {
-                    pushFollow(FOLLOW_longliteral_in_locationop1240);
-                    longliteral35=longliteral();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, longliteral35.getTree());
-
-                    }
-                    break;
-
-            }
-
-
-            char_literal36=(Token)match(input,34,FOLLOW_34_in_locationop1243); 
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:257:104: ( floatliteral | longliteral )
-            int alt5=2;
-            switch ( input.LA(1) ) {
-            case FLOAT:
-                {
-                alt5=1;
-                }
-                break;
-            case LONG:
-                {
-                alt5=2;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 5, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt5) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:257:105: floatliteral
-                    {
-                    pushFollow(FOLLOW_floatliteral_in_locationop1247);
-                    floatliteral37=floatliteral();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, floatliteral37.getTree());
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:257:118: longliteral
-                    {
-                    pushFollow(FOLLOW_longliteral_in_locationop1249);
-                    longliteral38=longliteral();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, longliteral38.getTree());
-
-                    }
-                    break;
-
-            }
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "locationop"
-
-
-    public static class containsop_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "containsop"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:260:1: containsop : containsproperty CONTAINS ^ stringliteral ;
-    public final CpQueryFilterParser.containsop_return containsop() throws RecognitionException {
-        CpQueryFilterParser.containsop_return retval = new CpQueryFilterParser.containsop_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token CONTAINS40=null;
-        CpQueryFilterParser.containsproperty_return containsproperty39 =null;
-
-        CpQueryFilterParser.stringliteral_return stringliteral41 =null;
-
-
-        Object CONTAINS40_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:260:12: ( containsproperty CONTAINS ^ stringliteral )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:261:3: containsproperty CONTAINS ^ stringliteral
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            pushFollow(FOLLOW_containsproperty_in_containsop1263);
-            containsproperty39=containsproperty();
-
-            state._fsp--;
-
-            adaptor.addChild(root_0, containsproperty39.getTree());
-
-            CONTAINS40=(Token)match(input,CONTAINS,FOLLOW_CONTAINS_in_containsop1265); 
-            CONTAINS40_tree = 
-            new ContainsOperand(CONTAINS40) 
-            ;
-            root_0 = (Object)adaptor.becomeRoot(CONTAINS40_tree, root_0);
-
-
-            pushFollow(FOLLOW_stringliteral_in_containsop1271);
-            stringliteral41=stringliteral();
-
-            state._fsp--;
-
-            adaptor.addChild(root_0, stringliteral41.getTree());
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "containsop"
-
-
-    public static class operation_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "operation"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:264:1: operation : ( '(' ! expression ')' !| equalityop | locationop | containsop );
-    public final CpQueryFilterParser.operation_return operation() throws RecognitionException {
-        CpQueryFilterParser.operation_return retval = new CpQueryFilterParser.operation_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token char_literal42=null;
-        Token char_literal44=null;
-        CpQueryFilterParser.expression_return expression43 =null;
-
-        CpQueryFilterParser.equalityop_return equalityop45 =null;
-
-        CpQueryFilterParser.locationop_return locationop46 =null;
-
-        CpQueryFilterParser.containsop_return containsop47 =null;
-
-
-        Object char_literal42_tree=null;
-        Object char_literal44_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:264:11: ( '(' ! expression ')' !| equalityop | locationop | containsop )
-            int alt6=4;
-            switch ( input.LA(1) ) {
-            case 31:
-                {
-                alt6=1;
-                }
-                break;
-            case ID:
-                {
-                switch ( input.LA(2) ) {
-                case EQ:
-                case GT:
-                case GTE:
-                case LT:
-                case LTE:
-                    {
-                    alt6=2;
-                    }
-                    break;
-                case WITHIN:
-                    {
-                    alt6=3;
-                    }
-                    break;
-                case CONTAINS:
-                    {
-                    alt6=4;
-                    }
-                    break;
-                default:
-                    NoViableAltException nvae =
-                        new NoViableAltException("", 6, 2, input);
-
-                    throw nvae;
-
-                }
-
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 6, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt6) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:265:2: '(' ! expression ')' !
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    char_literal42=(Token)match(input,31,FOLLOW_31_in_operation1281); 
-
-                    pushFollow(FOLLOW_expression_in_operation1284);
-                    expression43=expression();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, expression43.getTree());
-
-                    char_literal44=(Token)match(input,32,FOLLOW_32_in_operation1286); 
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:266:6: equalityop
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_equalityop_in_operation1294);
-                    equalityop45=equalityop();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, equalityop45.getTree());
-
-                    }
-                    break;
-                case 3 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:267:6: locationop
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_locationop_in_operation1302);
-                    locationop46=locationop();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, locationop46.getTree());
-
-                    }
-                    break;
-                case 4 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:268:6: containsop
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_containsop_in_operation1310);
-                    containsop47=containsop();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, containsop47.getTree());
-
-                    }
-                    break;
-
-            }
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "operation"
-
-
-    public static class notexp_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "notexp"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:272:1: notexp : ( NOT ^ operation | operation );
-    public final CpQueryFilterParser.notexp_return notexp() throws RecognitionException {
-        CpQueryFilterParser.notexp_return retval = new CpQueryFilterParser.notexp_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token NOT48=null;
-        CpQueryFilterParser.operation_return operation49 =null;
-
-        CpQueryFilterParser.operation_return operation50 =null;
-
-
-        Object NOT48_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:272:8: ( NOT ^ operation | operation )
-            int alt7=2;
-            switch ( input.LA(1) ) {
-            case NOT:
-                {
-                alt7=1;
-                }
-                break;
-            case ID:
-            case 31:
-                {
-                alt7=2;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 7, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt7) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:274:2: NOT ^ operation
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    NOT48=(Token)match(input,NOT,FOLLOW_NOT_in_notexp1326); 
-                    NOT48_tree = 
-                    new NotOperand(NOT48) 
-                    ;
-                    root_0 = (Object)adaptor.becomeRoot(NOT48_tree, root_0);
-
-
-                    pushFollow(FOLLOW_operation_in_notexp1332);
-                    operation49=operation();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, operation49.getTree());
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:275:3: operation
-                    {
-                    root_0 = (Object)adaptor.nil();
-
-
-                    pushFollow(FOLLOW_operation_in_notexp1338);
-                    operation50=operation();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, operation50.getTree());
-
-                    }
-                    break;
-
-            }
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "notexp"
-
-
-    public static class andexp_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "andexp"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:280:1: andexp : notexp ( AND ^ notexp )* ;
-    public final CpQueryFilterParser.andexp_return andexp() throws RecognitionException {
-        CpQueryFilterParser.andexp_return retval = new CpQueryFilterParser.andexp_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token AND52=null;
-        CpQueryFilterParser.notexp_return notexp51 =null;
-
-        CpQueryFilterParser.notexp_return notexp53 =null;
-
-
-        Object AND52_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:280:8: ( notexp ( AND ^ notexp )* )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:281:2: notexp ( AND ^ notexp )*
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            pushFollow(FOLLOW_notexp_in_andexp1352);
-            notexp51=notexp();
-
-            state._fsp--;
-
-            adaptor.addChild(root_0, notexp51.getTree());
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:281:9: ( AND ^ notexp )*
-            loop8:
-            do {
-                int alt8=2;
-                switch ( input.LA(1) ) {
-                case AND:
-                    {
-                    alt8=1;
-                    }
-                    break;
-
-                }
-
-                switch (alt8) {
-            	case 1 :
-            	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:281:10: AND ^ notexp
-            	    {
-            	    AND52=(Token)match(input,AND,FOLLOW_AND_in_andexp1355); 
-            	    AND52_tree = 
-            	    new AndOperand(AND52) 
-            	    ;
-            	    root_0 = (Object)adaptor.becomeRoot(AND52_tree, root_0);
-
-
-            	    pushFollow(FOLLOW_notexp_in_andexp1361);
-            	    notexp53=notexp();
-
-            	    state._fsp--;
-
-            	    adaptor.addChild(root_0, notexp53.getTree());
-
-            	    }
-            	    break;
-
-            	default :
-            	    break loop8;
-                }
-            } while (true);
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "andexp"
-
-
-    public static class expression_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "expression"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:286:1: expression : andexp ( OR ^ andexp )* ;
-    public final CpQueryFilterParser.expression_return expression() throws RecognitionException {
-        CpQueryFilterParser.expression_return retval = new CpQueryFilterParser.expression_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token OR55=null;
-        CpQueryFilterParser.andexp_return andexp54 =null;
-
-        CpQueryFilterParser.andexp_return andexp56 =null;
-
-
-        Object OR55_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:286:12: ( andexp ( OR ^ andexp )* )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:287:2: andexp ( OR ^ andexp )*
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            pushFollow(FOLLOW_andexp_in_expression1378);
-            andexp54=andexp();
-
-            state._fsp--;
-
-            adaptor.addChild(root_0, andexp54.getTree());
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:287:9: ( OR ^ andexp )*
-            loop9:
-            do {
-                int alt9=2;
-                switch ( input.LA(1) ) {
-                case OR:
-                    {
-                    alt9=1;
-                    }
-                    break;
-
-                }
-
-                switch (alt9) {
-            	case 1 :
-            	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:287:10: OR ^ andexp
-            	    {
-            	    OR55=(Token)match(input,OR,FOLLOW_OR_in_expression1381); 
-            	    OR55_tree = 
-            	    new OrOperand(OR55) 
-            	    ;
-            	    root_0 = (Object)adaptor.becomeRoot(OR55_tree, root_0);
-
-
-            	    pushFollow(FOLLOW_andexp_in_expression1387);
-            	    andexp56=andexp();
-
-            	    state._fsp--;
-
-            	    adaptor.addChild(root_0, andexp56.getTree());
-
-            	    }
-            	    break;
-
-            	default :
-            	    break loop9;
-                }
-            } while (true);
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "expression"
-
-
-    public static class direction_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "direction"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:296:1: direction : ( ASC | DESC ) ;
-    public final CpQueryFilterParser.direction_return direction() throws RecognitionException {
-        CpQueryFilterParser.direction_return retval = new CpQueryFilterParser.direction_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token set57=null;
-
-        Object set57_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:296:12: ( ( ASC | DESC ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            set57=(Token)input.LT(1);
-
-            if ( input.LA(1)==ASC||input.LA(1)==DESC ) {
-                input.consume();
-                adaptor.addChild(root_0, 
-                (Object)adaptor.create(set57)
-                );
-                state.errorRecovery=false;
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                throw mse;
-            }
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "direction"
-
-
-    public static class order_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "order"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:299:1: order : ( property ( direction )? ) ;
-    public final CpQueryFilterParser.order_return order() throws RecognitionException {
-        CpQueryFilterParser.order_return retval = new CpQueryFilterParser.order_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        CpQueryFilterParser.property_return property58 =null;
-
-        CpQueryFilterParser.direction_return direction59 =null;
-
-
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:300:3: ( ( property ( direction )? ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:300:5: ( property ( direction )? )
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:300:5: ( property ( direction )? )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:300:6: property ( direction )?
-            {
-            pushFollow(FOLLOW_property_in_order1424);
-            property58=property();
-
-            state._fsp--;
-
-            adaptor.addChild(root_0, property58.getTree());
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:300:15: ( direction )?
-            int alt10=2;
-            switch ( input.LA(1) ) {
-                case ASC:
-                case DESC:
-                    {
-                    alt10=1;
-                    }
-                    break;
-            }
-
-            switch (alt10) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:300:15: direction
-                    {
-                    pushFollow(FOLLOW_direction_in_order1426);
-                    direction59=direction();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, direction59.getTree());
-
-                    }
-                    break;
-
-            }
-
-
-            }
-
-
-
-            		String property = (property58!=null?input.toString(property58.start,property58.stop):null); 
-            		String direction = (direction59!=null?input.toString(direction59.start,direction59.stop):null);
-            		query.addSort(new SortPredicate(property, direction));
-                
-              
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "order"
-
-
-    public static class select_subject_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "select_subject"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:311:1: select_subject : ID ;
-    public final CpQueryFilterParser.select_subject_return select_subject() throws RecognitionException {
-        CpQueryFilterParser.select_subject_return retval = new CpQueryFilterParser.select_subject_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token ID60=null;
-
-        Object ID60_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:312:3: ( ID )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:312:5: ID
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            ID60=(Token)match(input,ID,FOLLOW_ID_in_select_subject1445); 
-            ID60_tree = 
-            (Object)adaptor.create(ID60)
-            ;
-            adaptor.addChild(root_0, ID60_tree);
-
-
-
-
-              query.addSelect((ID60!=null?ID60.getText():null));
-
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "select_subject"
-
-
-    public static class select_assign_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "select_assign"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:320:1: select_assign : target= ID ':' source= ID ;
-    public final CpQueryFilterParser.select_assign_return select_assign() throws RecognitionException {
-        CpQueryFilterParser.select_assign_return retval = new CpQueryFilterParser.select_assign_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token target=null;
-        Token source=null;
-        Token char_literal61=null;
-
-        Object target_tree=null;
-        Object source_tree=null;
-        Object char_literal61_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:321:3: (target= ID ':' source= ID )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:321:5: target= ID ':' source= ID
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            target=(Token)match(input,ID,FOLLOW_ID_in_select_assign1462); 
-            target_tree = 
-            (Object)adaptor.create(target)
-            ;
-            adaptor.addChild(root_0, target_tree);
-
-
-            char_literal61=(Token)match(input,35,FOLLOW_35_in_select_assign1464); 
-            char_literal61_tree = 
-            (Object)adaptor.create(char_literal61)
-            ;
-            adaptor.addChild(root_0, char_literal61_tree);
-
-
-            source=(Token)match(input,ID,FOLLOW_ID_in_select_assign1468); 
-            source_tree = 
-            (Object)adaptor.create(source)
-            ;
-            adaptor.addChild(root_0, source_tree);
-
-
-
-
-              query.addSelect((target!=null?target.getText():null), (source!=null?source.getText():null));
-
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "select_assign"
-
-
-    public static class select_expr_return extends ParserRuleReturnScope {
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "select_expr"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:327:1: select_expr : ( '*' | select_subject ( ',' select_subject )* | '{' select_assign ( ',' select_assign )* '}' ) ;
-    public final CpQueryFilterParser.select_expr_return select_expr() throws RecognitionException {
-        CpQueryFilterParser.select_expr_return retval = new CpQueryFilterParser.select_expr_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token char_literal62=null;
-        Token char_literal64=null;
-        Token char_literal66=null;
-        Token char_literal68=null;
-        Token char_literal70=null;
-        CpQueryFilterParser.select_subject_return select_subject63 =null;
-
-        CpQueryFilterParser.select_subject_return select_subject65 =null;
-
-        CpQueryFilterParser.select_assign_return select_assign67 =null;
-
-        CpQueryFilterParser.select_assign_return select_assign69 =null;
-
-
-        Object char_literal62_tree=null;
-        Object char_literal64_tree=null;
-        Object char_literal66_tree=null;
-        Object char_literal68_tree=null;
-        Object char_literal70_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:328:3: ( ( '*' | select_subject ( ',' select_subject )* | '{' select_assign ( ',' select_assign )* '}' ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:328:5: ( '*' | select_subject ( ',' select_subject )* | '{' select_assign ( ',' select_assign )* '}' )
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:328:5: ( '*' | select_subject ( ',' select_subject )* | '{' select_assign ( ',' select_assign )* '}' )
-            int alt13=3;
-            switch ( input.LA(1) ) {
-            case 33:
-                {
-                alt13=1;
-                }
-                break;
-            case ID:
-                {
-                alt13=2;
-                }
-                break;
-            case 39:
-                {
-                alt13=3;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 13, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt13) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:328:6: '*'
-                    {
-                    char_literal62=(Token)match(input,33,FOLLOW_33_in_select_expr1482); 
-                    char_literal62_tree = 
-                    (Object)adaptor.create(char_literal62)
-                    ;
-                    adaptor.addChild(root_0, char_literal62_tree);
-
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:328:12: select_subject ( ',' select_subject )*
-                    {
-                    pushFollow(FOLLOW_select_subject_in_select_expr1486);
-                    select_subject63=select_subject();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, select_subject63.getTree());
-
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:328:27: ( ',' select_subject )*
-                    loop11:
-                    do {
-                        int alt11=2;
-                        switch ( input.LA(1) ) {
-                        case 34:
-                            {
-                            alt11=1;
-                            }
-                            break;
-
-                        }
-
-                        switch (alt11) {
-                    	case 1 :
-                    	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:328:28: ',' select_subject
-                    	    {
-                    	    char_literal64=(Token)match(input,34,FOLLOW_34_in_select_expr1489); 
-                    	    char_literal64_tree = 
-                    	    (Object)adaptor.create(char_literal64)
-                    	    ;
-                    	    adaptor.addChild(root_0, char_literal64_tree);
-
-
-                    	    pushFollow(FOLLOW_select_subject_in_select_expr1491);
-                    	    select_subject65=select_subject();
-
-                    	    state._fsp--;
-
-                    	    adaptor.addChild(root_0, select_subject65.getTree());
-
-                    	    }
-                    	    break;
-
-                    	default :
-                    	    break loop11;
-                        }
-                    } while (true);
-
-
-                    }
-                    break;
-                case 3 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:328:52: '{' select_assign ( ',' select_assign )* '}'
-                    {
-                    char_literal66=(Token)match(input,39,FOLLOW_39_in_select_expr1498); 
-                    char_literal66_tree = 
-                    (Object)adaptor.create(char_literal66)
-                    ;
-                    adaptor.addChild(root_0, char_literal66_tree);
-
-
-                    pushFollow(FOLLOW_select_assign_in_select_expr1500);
-                    select_assign67=select_assign();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, select_assign67.getTree());
-
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:328:70: ( ',' select_assign )*
-                    loop12:
-                    do {
-                        int alt12=2;
-                        switch ( input.LA(1) ) {
-                        case 34:
-                            {
-                            alt12=1;
-                            }
-                            break;
-
-                        }
-
-                        switch (alt12) {
-                    	case 1 :
-                    	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:328:71: ',' select_assign
-                    	    {
-                    	    char_literal68=(Token)match(input,34,FOLLOW_34_in_select_expr1503); 
-                    	    char_literal68_tree = 
-                    	    (Object)adaptor.create(char_literal68)
-                    	    ;
-                    	    adaptor.addChild(root_0, char_literal68_tree);
-
-
-                    	    pushFollow(FOLLOW_select_assign_in_select_expr1505);
-                    	    select_assign69=select_assign();
-
-                    	    state._fsp--;
-
-                    	    adaptor.addChild(root_0, select_assign69.getTree());
-
-                    	    }
-                    	    break;
-
-                    	default :
-                    	    break loop12;
-                        }
-                    } while (true);
-
-
-                    char_literal70=(Token)match(input,40,FOLLOW_40_in_select_expr1510); 
-                    char_literal70_tree = 
-                    (Object)adaptor.create(char_literal70)
-                    ;
-                    adaptor.addChild(root_0, char_literal70_tree);
-
-
-                    }
-                    break;
-
-            }
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "select_expr"
-
-
-    public static class ql_return extends ParserRuleReturnScope {
-        public Query query;
-        Object tree;
-        public Object getTree() { return tree; }
-    };
-
-
-    // $ANTLR start "ql"
-    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:332:1: ql returns [Query query] : ( 'select' ! select_expr !)? ( ( 'where' !)? expression )? ( 'order by' ! order ! ( ',' ! order !)* )? ;
-    public final CpQueryFilterParser.ql_return ql() throws RecognitionException {
-        CpQueryFilterParser.ql_return retval = new CpQueryFilterParser.ql_return();
-        retval.start = input.LT(1);
-
-
-        Object root_0 = null;
-
-        Token string_literal71=null;
-        Token string_literal73=null;
-        Token string_literal75=null;
-        Token char_literal77=null;
-        CpQueryFilterParser.select_expr_return select_expr72 =null;
-
-        CpQueryFilterParser.expression_return expression74 =null;
-
-        CpQueryFilterParser.order_return order76 =null;
-
-        CpQueryFilterParser.order_return order78 =null;
-
-
-        Object string_literal71_tree=null;
-        Object string_literal73_tree=null;
-        Object string_literal75_tree=null;
-        Object char_literal77_tree=null;
-
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:333:3: ( ( 'select' ! select_expr !)? ( ( 'where' !)? expression )? ( 'order by' ! order ! ( ',' ! order !)* )? )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:333:5: ( 'select' ! select_expr !)? ( ( 'where' !)? expression )? ( 'order by' ! order ! ( ',' ! order !)* )?
-            {
-            root_0 = (Object)adaptor.nil();
-
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:333:5: ( 'select' ! select_expr !)?
-            int alt14=2;
-            switch ( input.LA(1) ) {
-                case 37:
-                    {
-                    alt14=1;
-                    }
-                    break;
-            }
-
-            switch (alt14) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:333:6: 'select' ! select_expr !
-                    {
-                    string_literal71=(Token)match(input,37,FOLLOW_37_in_ql1533); 
-
-                    pushFollow(FOLLOW_select_expr_in_ql1536);
-                    select_expr72=select_expr();
-
-                    state._fsp--;
-
-
-                    }
-                    break;
-
-            }
-
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:333:31: ( ( 'where' !)? expression )?
-            int alt16=2;
-            switch ( input.LA(1) ) {
-                case ID:
-                case NOT:
-                case 31:
-                case 38:
-                    {
-                    alt16=1;
-                    }
-                    break;
-            }
-
-            switch (alt16) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:333:32: ( 'where' !)? expression
-                    {
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:333:39: ( 'where' !)?
-                    int alt15=2;
-                    switch ( input.LA(1) ) {
-                        case 38:
-                            {
-                            alt15=1;
-                            }
-                            break;
-                    }
-
-                    switch (alt15) {
-                        case 1 :
-                            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:333:39: 'where' !
-                            {
-                            string_literal73=(Token)match(input,38,FOLLOW_38_in_ql1542); 
-
-                            }
-                            break;
-
-                    }
-
-
-                    pushFollow(FOLLOW_expression_in_ql1546);
-                    expression74=expression();
-
-                    state._fsp--;
-
-                    adaptor.addChild(root_0, expression74.getTree());
-
-                    }
-                    break;
-
-            }
-
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:333:55: ( 'order by' ! order ! ( ',' ! order !)* )?
-            int alt18=2;
-            switch ( input.LA(1) ) {
-                case 36:
-                    {
-                    alt18=1;
-                    }
-                    break;
-            }
-
-            switch (alt18) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:333:56: 'order by' ! order ! ( ',' ! order !)*
-                    {
-                    string_literal75=(Token)match(input,36,FOLLOW_36_in_ql1551); 
-
-                    pushFollow(FOLLOW_order_in_ql1554);
-                    order76=order();
-
-                    state._fsp--;
-
-
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:333:75: ( ',' ! order !)*
-                    loop17:
-                    do {
-                        int alt17=2;
-                        switch ( input.LA(1) ) {
-                        case 34:
-                            {
-                            alt17=1;
-                            }
-                            break;
-
-                        }
-
-                        switch (alt17) {
-                    	case 1 :
-                    	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:333:76: ',' ! order !
-                    	    {
-                    	    char_literal77=(Token)match(input,34,FOLLOW_34_in_ql1558); 
-
-                    	    pushFollow(FOLLOW_order_in_ql1561);
-                    	    order78=order();
-
-                    	    state._fsp--;
-
-
-                    	    }
-                    	    break;
-
-                    	default :
-                    	    break loop17;
-                        }
-                    } while (true);
-
-
-                    }
-                    break;
-
-            }
-
-
-
-
-              if((expression74!=null?((Object)expression74.tree):null) instanceof Operand){
-                query.setRootOperand((Operand)(expression74!=null?((Object)expression74.tree):null));
-              }
-              
-              retval.query = query;
-
-
-
-
-            }
-
-            retval.stop = input.LT(-1);
-
-
-            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
-            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
-
-        }
-         
-        finally {
-        	// do for sure before leaving
-        }
-        return retval;
-    }
-    // $ANTLR end "ql"
-
-    // Delegated rules
-
-
- 
-
-    public static final BitSet FOLLOW_ID_in_property991 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_ID_in_containsproperty1002 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_ID_in_withinproperty1013 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_BOOLEAN_in_booleanliteral1024 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_LONG_in_longliteral1038 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_UUID_in_uuidliteral1052 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_STRING_in_stringliteral1065 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_FLOAT_in_floatliteral1080 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_booleanliteral_in_value1096 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_longliteral_in_value1102 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_uuidliteral_in_value1108 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_stringliteral_in_value1114 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_floatliteral_in_value1120 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_property_in_equalityop1145 = new BitSet(new long[]{0x0000000000080000L});
-    public static final BitSet FOLLOW_LT_in_equalityop1147 = new BitSet(new long[]{0x0000000012042040L});
-    public static final BitSet FOLLOW_value_in_equalityop1153 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_property_in_equalityop1158 = new BitSet(new long[]{0x0000000000100000L});
-    public static final BitSet FOLLOW_LTE_in_equalityop1160 = new BitSet(new long[]{0x0000000012042040L});
-    public static final BitSet FOLLOW_value_in_equalityop1166 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_property_in_equalityop1171 = new BitSet(new long[]{0x0000000000000200L});
-    public static final BitSet FOLLOW_EQ_in_equalityop1173 = new BitSet(new long[]{0x0000000012042040L});
-    public static final BitSet FOLLOW_value_in_equalityop1179 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_property_in_equalityop1184 = new BitSet(new long[]{0x0000000000004000L});
-    public static final BitSet FOLLOW_GT_in_equalityop1186 = new BitSet(new long[]{0x0000000012042040L});
-    public static final BitSet FOLLOW_value_in_equalityop1192 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_property_in_equalityop1197 = new BitSet(new long[]{0x0000000000008000L});
-    public static final BitSet FOLLOW_GTE_in_equalityop1199 = new BitSet(new long[]{0x0000000012042040L});
-    public static final BitSet FOLLOW_value_in_equalityop1205 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_withinproperty_in_locationop1220 = new BitSet(new long[]{0x0000000020000000L});
-    public static final BitSet FOLLOW_WITHIN_in_locationop1222 = new BitSet(new long[]{0x0000000000042000L});
-    public static final BitSet FOLLOW_floatliteral_in_locationop1229 = new BitSet(new long[]{0x0000000000800000L});
-    public static final BitSet FOLLOW_longliteral_in_locationop1231 = new BitSet(new long[]{0x0000000000800000L});
-    public static final BitSet FOLLOW_OF_in_locationop1234 = new BitSet(new long[]{0x0000000000042000L});
-    public static final BitSet FOLLOW_floatliteral_in_locationop1238 = new BitSet(new long[]{0x0000000400000000L});
-    public static final BitSet FOLLOW_longliteral_in_locationop1240 = new BitSet(new long[]{0x0000000400000000L});
-    public static final BitSet FOLLOW_34_in_locationop1243 = new BitSet(new long[]{0x0000000000042000L});
-    public static final BitSet FOLLOW_floatliteral_in_locationop1247 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_longliteral_in_locationop1249 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_containsproperty_in_containsop1263 = new BitSet(new long[]{0x0000000000000080L});
-    public static final BitSet FOLLOW_CONTAINS_in_containsop1265 = new BitSet(new long[]{0x0000000002000000L});
-    public static final BitSet FOLLOW_stringliteral_in_containsop1271 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_31_in_operation1281 = new BitSet(new long[]{0x0000000080220000L});
-    public static final BitSet FOLLOW_expression_in_operation1284 = new BitSet(new long[]{0x0000000100000000L});
-    public static final BitSet FOLLOW_32_in_operation1286 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_equalityop_in_operation1294 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_locationop_in_operation1302 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_containsop_in_operation1310 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_NOT_in_notexp1326 = new BitSet(new long[]{0x0000000080020000L});
-    public static final BitSet FOLLOW_operation_in_notexp1332 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_operation_in_notexp1338 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_notexp_in_andexp1352 = new BitSet(new long[]{0x0000000000000012L});
-    public static final BitSet FOLLOW_AND_in_andexp1355 = new BitSet(new long[]{0x0000000080220000L});
-    public static final BitSet FOLLOW_notexp_in_andexp1361 = new BitSet(new long[]{0x0000000000000012L});
-    public static final BitSet FOLLOW_andexp_in_expression1378 = new BitSet(new long[]{0x0000000001000002L});
-    public static final BitSet FOLLOW_OR_in_expression1381 = new BitSet(new long[]{0x0000000080220000L});
-    public static final BitSet FOLLOW_andexp_in_expression1387 = new BitSet(new long[]{0x0000000001000002L});
-    public static final BitSet FOLLOW_property_in_order1424 = new BitSet(new long[]{0x0000000000000122L});
-    public static final BitSet FOLLOW_direction_in_order1426 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_ID_in_select_subject1445 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_ID_in_select_assign1462 = new BitSet(new long[]{0x0000000800000000L});
-    public static final BitSet FOLLOW_35_in_select_assign1464 = new BitSet(new long[]{0x0000000000020000L});
-    public static final BitSet FOLLOW_ID_in_select_assign1468 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_33_in_select_expr1482 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_select_subject_in_select_expr1486 = new BitSet(new long[]{0x0000000400000002L});
-    public static final BitSet FOLLOW_34_in_select_expr1489 = new BitSet(new long[]{0x0000000000020000L});
-    public static final BitSet FOLLOW_select_subject_in_select_expr1491 = new BitSet(new long[]{0x0000000400000002L});
-    public static final BitSet FOLLOW_39_in_select_expr1498 = new BitSet(new long[]{0x0000000000020000L});
-    public static final BitSet FOLLOW_select_assign_in_select_expr1500 = new BitSet(new long[]{0x0000010400000000L});
-    public static final BitSet FOLLOW_34_in_select_expr1503 = new BitSet(new long[]{0x0000000000020000L});
-    public static final BitSet FOLLOW_select_assign_in_select_expr1505 = new BitSet(new long[]{0x0000010400000000L});
-    public static final BitSet FOLLOW_40_in_select_expr1510 = new BitSet(new long[]{0x0000000000000002L});
-    public static final BitSet FOLLOW_37_in_ql1533 = new BitSet(new long[]{0x0000008200020000L});
-    public static final BitSet FOLLOW_select_expr_in_ql1536 = new BitSet(new long[]{0x0000005080220002L});
-    public static final BitSet FOLLOW_38_in_ql1542 = new BitSet(new long[]{0x0000000080220000L});
-    public static final BitSet FOLLOW_expression_in_ql1546 = new BitSet(new long[]{0x0000001000000002L});
-    public static final BitSet FOLLOW_36_in_ql1551 = new BitSet(new long[]{0x0000000000020000L});
-    public static final BitSet FOLLOW_order_in_ql1554 = new BitSet(new long[]{0x0000000400000002L});
-    public static final BitSet FOLLOW_34_in_ql1558 = new BitSet(new long[]{0x0000000000020000L});
-    public static final BitSet FOLLOW_order_in_ql1561 = new BitSet(new long[]{0x0000000400000002L});
-
-}
\ No newline at end of file


[5/6] Fix for the way that arrays are serialized by JSON and a test to verify that arrays work as expected.

Posted by sn...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4e428e36/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/query/tree/CpQueryFilterLexer.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/query/tree/CpQueryFilterLexer.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/query/tree/CpQueryFilterLexer.java
deleted file mode 100644
index 20cf4a1..0000000
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/query/tree/CpQueryFilterLexer.java
+++ /dev/null
@@ -1,3123 +0,0 @@
-// $ANTLR 3.4 org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g 2014-08-25 10:56:14
-
-/*
- * 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.
- */
-
-package org.apache.usergrid.persistence.index.query.tree;
-
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.usergrid.persistence.index.exceptions.QueryTokenException;
-
-
-
-import org.antlr.runtime.*;
-import java.util.Stack;
-import java.util.List;
-import java.util.ArrayList;
-
-@SuppressWarnings({"all", "warnings", "unchecked"})
-public class CpQueryFilterLexer extends Lexer {
-    public static final int EOF=-1;
-    public static final int T__31=31;
-    public static final int T__32=32;
-    public static final int T__33=33;
-    public static final int T__34=34;
-    public static final int T__35=35;
-    public static final int T__36=36;
-    public static final int T__37=37;
-    public static final int T__38=38;
-    public static final int T__39=39;
-    public static final int T__40=40;
-    public static final int AND=4;
-    public static final int ASC=5;
-    public static final int BOOLEAN=6;
-    public static final int CONTAINS=7;
-    public static final int DESC=8;
-    public static final int EQ=9;
-    public static final int ESC_SEQ=10;
-    public static final int EXPONENT=11;
-    public static final int FALSE=12;
-    public static final int FLOAT=13;
-    public static final int GT=14;
-    public static final int GTE=15;
-    public static final int HEX_DIGIT=16;
-    public static final int ID=17;
-    public static final int LONG=18;
-    public static final int LT=19;
-    public static final int LTE=20;
-    public static final int NOT=21;
-    public static final int OCTAL_ESC=22;
-    public static final int OF=23;
-    public static final int OR=24;
-    public static final int STRING=25;
-    public static final int TRUE=26;
-    public static final int UNICODE_ESC=27;
-    public static final int UUID=28;
-    public static final int WITHIN=29;
-    public static final int WS=30;
-
-
-
-
-      private static final Logger logger = LoggerFactory
-          .getLogger(CpQueryFilterLexer.class);
-
-
-
-
-    	@Override
-    	public void emitErrorMessage(String msg) {
-    		logger.info(msg);
-    	}
-
-    	@Override
-        public void recover(RecognitionException e) {
-             //We don't want to recover, we want to re-throw to the user since they passed us invalid input
-             throw new QueryTokenException(e);
-        }
-
-
-
-
-    // delegates
-    // delegators
-    public Lexer[] getDelegates() {
-        return new Lexer[] {};
-    }
-
-    public CpQueryFilterLexer() {} 
-    public CpQueryFilterLexer(CharStream input) {
-        this(input, new RecognizerSharedState());
-    }
-    public CpQueryFilterLexer(CharStream input, RecognizerSharedState state) {
-        super(input,state);
-    }
-    public String getGrammarFileName() { return "org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g"; }
-
-    // $ANTLR start "T__31"
-    public final void mT__31() throws RecognitionException {
-        try {
-            int _type = T__31;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:52:7: ( '(' )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:52:9: '('
-            {
-            match('('); 
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "T__31"
-
-    // $ANTLR start "T__32"
-    public final void mT__32() throws RecognitionException {
-        try {
-            int _type = T__32;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:53:7: ( ')' )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:53:9: ')'
-            {
-            match(')'); 
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "T__32"
-
-    // $ANTLR start "T__33"
-    public final void mT__33() throws RecognitionException {
-        try {
-            int _type = T__33;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:54:7: ( '*' )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:54:9: '*'
-            {
-            match('*'); 
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "T__33"
-
-    // $ANTLR start "T__34"
-    public final void mT__34() throws RecognitionException {
-        try {
-            int _type = T__34;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:55:7: ( ',' )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:55:9: ','
-            {
-            match(','); 
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "T__34"
-
-    // $ANTLR start "T__35"
-    public final void mT__35() throws RecognitionException {
-        try {
-            int _type = T__35;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:56:7: ( ':' )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:56:9: ':'
-            {
-            match(':'); 
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "T__35"
-
-    // $ANTLR start "T__36"
-    public final void mT__36() throws RecognitionException {
-        try {
-            int _type = T__36;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:57:7: ( 'order by' )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:57:9: 'order by'
-            {
-            match("order by"); 
-
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "T__36"
-
-    // $ANTLR start "T__37"
-    public final void mT__37() throws RecognitionException {
-        try {
-            int _type = T__37;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:58:7: ( 'select' )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:58:9: 'select'
-            {
-            match("select"); 
-
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "T__37"
-
-    // $ANTLR start "T__38"
-    public final void mT__38() throws RecognitionException {
-        try {
-            int _type = T__38;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:59:7: ( 'where' )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:59:9: 'where'
-            {
-            match("where"); 
-
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "T__38"
-
-    // $ANTLR start "T__39"
-    public final void mT__39() throws RecognitionException {
-        try {
-            int _type = T__39;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:60:7: ( '{' )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:60:9: '{'
-            {
-            match('{'); 
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "T__39"
-
-    // $ANTLR start "T__40"
-    public final void mT__40() throws RecognitionException {
-        try {
-            int _type = T__40;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:61:7: ( '}' )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:61:9: '}'
-            {
-            match('}'); 
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "T__40"
-
-    // $ANTLR start "LT"
-    public final void mLT() throws RecognitionException {
-        try {
-            int _type = LT;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:105:5: ( '<' | 'lt' )
-            int alt1=2;
-            switch ( input.LA(1) ) {
-            case '<':
-                {
-                alt1=1;
-                }
-                break;
-            case 'l':
-                {
-                alt1=2;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 1, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt1) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:105:7: '<'
-                    {
-                    match('<'); 
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:105:13: 'lt'
-                    {
-                    match("lt"); 
-
-
-
-                    }
-                    break;
-
-            }
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "LT"
-
-    // $ANTLR start "LTE"
-    public final void mLTE() throws RecognitionException {
-        try {
-            int _type = LTE;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:107:5: ( '<=' | 'lte' )
-            int alt2=2;
-            switch ( input.LA(1) ) {
-            case '<':
-                {
-                alt2=1;
-                }
-                break;
-            case 'l':
-                {
-                alt2=2;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 2, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt2) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:107:7: '<='
-                    {
-                    match("<="); 
-
-
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:107:15: 'lte'
-                    {
-                    match("lte"); 
-
-
-
-                    }
-                    break;
-
-            }
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "LTE"
-
-    // $ANTLR start "EQ"
-    public final void mEQ() throws RecognitionException {
-        try {
-            int _type = EQ;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:109:5: ( '=' | 'eq' )
-            int alt3=2;
-            switch ( input.LA(1) ) {
-            case '=':
-                {
-                alt3=1;
-                }
-                break;
-            case 'e':
-                {
-                alt3=2;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 3, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt3) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:109:7: '='
-                    {
-                    match('='); 
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:109:13: 'eq'
-                    {
-                    match("eq"); 
-
-
-
-                    }
-                    break;
-
-            }
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "EQ"
-
-    // $ANTLR start "GT"
-    public final void mGT() throws RecognitionException {
-        try {
-            int _type = GT;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:111:5: ( '>' | 'gt' )
-            int alt4=2;
-            switch ( input.LA(1) ) {
-            case '>':
-                {
-                alt4=1;
-                }
-                break;
-            case 'g':
-                {
-                alt4=2;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 4, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt4) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:111:7: '>'
-                    {
-                    match('>'); 
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:111:13: 'gt'
-                    {
-                    match("gt"); 
-
-
-
-                    }
-                    break;
-
-            }
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "GT"
-
-    // $ANTLR start "GTE"
-    public final void mGTE() throws RecognitionException {
-        try {
-            int _type = GTE;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:113:5: ( '>=' | 'gte' )
-            int alt5=2;
-            switch ( input.LA(1) ) {
-            case '>':
-                {
-                alt5=1;
-                }
-                break;
-            case 'g':
-                {
-                alt5=2;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 5, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt5) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:113:7: '>='
-                    {
-                    match(">="); 
-
-
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:113:15: 'gte'
-                    {
-                    match("gte"); 
-
-
-
-                    }
-                    break;
-
-            }
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "GTE"
-
-    // $ANTLR start "BOOLEAN"
-    public final void mBOOLEAN() throws RecognitionException {
-        try {
-            int _type = BOOLEAN;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:117:9: ( ( TRUE | FALSE ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:117:11: ( TRUE | FALSE )
-            {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:117:11: ( TRUE | FALSE )
-            int alt6=2;
-            switch ( input.LA(1) ) {
-            case 'T':
-            case 't':
-                {
-                alt6=1;
-                }
-                break;
-            case 'F':
-            case 'f':
-                {
-                alt6=2;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 6, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt6) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:117:12: TRUE
-                    {
-                    mTRUE(); 
-
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:117:17: FALSE
-                    {
-                    mFALSE(); 
-
-
-                    }
-                    break;
-
-            }
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "BOOLEAN"
-
-    // $ANTLR start "AND"
-    public final void mAND() throws RecognitionException {
-        try {
-            int _type = AND;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:119:5: ( ( 'A' | 'a' ) ( 'N' | 'n' ) ( 'D' | 'd' ) | '&&' )
-            int alt7=2;
-            switch ( input.LA(1) ) {
-            case 'A':
-            case 'a':
-                {
-                alt7=1;
-                }
-                break;
-            case '&':
-                {
-                alt7=2;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 7, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt7) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:119:7: ( 'A' | 'a' ) ( 'N' | 'n' ) ( 'D' | 'd' )
-                    {
-                    if ( input.LA(1)=='A'||input.LA(1)=='a' ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    if ( input.LA(1)=='D'||input.LA(1)=='d' ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:119:37: '&&'
-                    {
-                    match("&&"); 
-
-
-
-                    }
-                    break;
-
-            }
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "AND"
-
-    // $ANTLR start "OR"
-    public final void mOR() throws RecognitionException {
-        try {
-            int _type = OR;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:121:5: ( ( 'O' | 'o' ) ( 'R' | 'r' ) | '||' )
-            int alt8=2;
-            switch ( input.LA(1) ) {
-            case 'O':
-            case 'o':
-                {
-                alt8=1;
-                }
-                break;
-            case '|':
-                {
-                alt8=2;
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 8, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt8) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:121:7: ( 'O' | 'o' ) ( 'R' | 'r' )
-                    {
-                    if ( input.LA(1)=='O'||input.LA(1)=='o' ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    if ( input.LA(1)=='R'||input.LA(1)=='r' ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:121:28: '||'
-                    {
-                    match("||"); 
-
-
-
-                    }
-                    break;
-
-            }
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "OR"
-
-    // $ANTLR start "NOT"
-    public final void mNOT() throws RecognitionException {
-        try {
-            int _type = NOT;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:123:5: ( ( 'N' | 'n' ) ( 'O' | 'o' ) ( 'T' | 't' ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:123:7: ( 'N' | 'n' ) ( 'O' | 'o' ) ( 'T' | 't' )
-            {
-            if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='O'||input.LA(1)=='o' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='T'||input.LA(1)=='t' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "NOT"
-
-    // $ANTLR start "ASC"
-    public final void mASC() throws RecognitionException {
-        try {
-            int _type = ASC;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:125:5: ( ( 'A' | 'a' ) ( 'S' | 's' ) ( 'C' | 'c' ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:125:7: ( 'A' | 'a' ) ( 'S' | 's' ) ( 'C' | 'c' )
-            {
-            if ( input.LA(1)=='A'||input.LA(1)=='a' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='S'||input.LA(1)=='s' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='C'||input.LA(1)=='c' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "ASC"
-
-    // $ANTLR start "DESC"
-    public final void mDESC() throws RecognitionException {
-        try {
-            int _type = DESC;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:127:6: ( ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'S' | 's' ) ( 'C' | 'c' ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:127:8: ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'S' | 's' ) ( 'C' | 'c' )
-            {
-            if ( input.LA(1)=='D'||input.LA(1)=='d' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='S'||input.LA(1)=='s' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='C'||input.LA(1)=='c' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "DESC"
-
-    // $ANTLR start "CONTAINS"
-    public final void mCONTAINS() throws RecognitionException {
-        try {
-            int _type = CONTAINS;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:129:10: ( ( 'C' | 'c' ) ( 'O' | 'o' ) ( 'N' | 'n' ) ( 'T' | 't' ) ( 'A' | 'a' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'S' | 's' ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:129:12: ( 'C' | 'c' ) ( 'O' | 'o' ) ( 'N' | 'n' ) ( 'T' | 't' ) ( 'A' | 'a' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'S' | 's' )
-            {
-            if ( input.LA(1)=='C'||input.LA(1)=='c' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='O'||input.LA(1)=='o' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='T'||input.LA(1)=='t' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='A'||input.LA(1)=='a' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='I'||input.LA(1)=='i' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='S'||input.LA(1)=='s' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "CONTAINS"
-
-    // $ANTLR start "WITHIN"
-    public final void mWITHIN() throws RecognitionException {
-        try {
-            int _type = WITHIN;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:131:8: ( ( 'W' | 'w' ) ( 'I' | 'i' ) ( 'T' | 't' ) ( 'H' | 'h' ) ( 'I' | 'i' ) ( 'N' | 'n' ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:131:10: ( 'W' | 'w' ) ( 'I' | 'i' ) ( 'T' | 't' ) ( 'H' | 'h' ) ( 'I' | 'i' ) ( 'N' | 'n' )
-            {
-            if ( input.LA(1)=='W'||input.LA(1)=='w' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='I'||input.LA(1)=='i' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='T'||input.LA(1)=='t' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='H'||input.LA(1)=='h' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='I'||input.LA(1)=='i' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "WITHIN"
-
-    // $ANTLR start "OF"
-    public final void mOF() throws RecognitionException {
-        try {
-            int _type = OF;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:133:4: ( ( 'O' | 'o' ) ( 'F' | 'f' ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:133:6: ( 'O' | 'o' ) ( 'F' | 'f' )
-            {
-            if ( input.LA(1)=='O'||input.LA(1)=='o' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='F'||input.LA(1)=='f' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "OF"
-
-    // $ANTLR start "UUID"
-    public final void mUUID() throws RecognitionException {
-        try {
-            int _type = UUID;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:135:6: ( HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT '-' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT '-' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT '-' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT '-' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:135:9: HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT '-' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT '-' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT '-' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT '-' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
-            {
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            match('-'); 
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            match('-'); 
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            match('-'); 
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            match('-'); 
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "UUID"
-
-    // $ANTLR start "ID"
-    public final void mID() throws RecognitionException {
-        try {
-            int _type = ID;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:146:5: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | '.' | '-' )* )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:146:7: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | '.' | '-' )*
-            {
-            if ( (input.LA(1) >= 'A' && input.LA(1) <= 'Z')||input.LA(1)=='_'||(input.LA(1) >= 'a' && input.LA(1) <= 'z') ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:146:31: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | '.' | '-' )*
-            loop9:
-            do {
-                int alt9=2;
-                switch ( input.LA(1) ) {
-                case '-':
-                case '.':
-                case '0':
-                case '1':
-                case '2':
-                case '3':
-                case '4':
-                case '5':
-                case '6':
-                case '7':
-                case '8':
-                case '9':
-                case 'A':
-                case 'B':
-                case 'C':
-                case 'D':
-                case 'E':
-                case 'F':
-                case 'G':
-                case 'H':
-                case 'I':
-                case 'J':
-                case 'K':
-                case 'L':
-                case 'M':
-                case 'N':
-                case 'O':
-                case 'P':
-                case 'Q':
-                case 'R':
-                case 'S':
-                case 'T':
-                case 'U':
-                case 'V':
-                case 'W':
-                case 'X':
-                case 'Y':
-                case 'Z':
-                case '_':
-                case 'a':
-                case 'b':
-                case 'c':
-                case 'd':
-                case 'e':
-                case 'f':
-                case 'g':
-                case 'h':
-                case 'i':
-                case 'j':
-                case 'k':
-                case 'l':
-                case 'm':
-                case 'n':
-                case 'o':
-                case 'p':
-                case 'q':
-                case 'r':
-                case 's':
-                case 't':
-                case 'u':
-                case 'v':
-                case 'w':
-                case 'x':
-                case 'y':
-                case 'z':
-                    {
-                    alt9=1;
-                    }
-                    break;
-
-                }
-
-                switch (alt9) {
-            	case 1 :
-            	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:
-            	    {
-            	    if ( (input.LA(1) >= '-' && input.LA(1) <= '.')||(input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'Z')||input.LA(1)=='_'||(input.LA(1) >= 'a' && input.LA(1) <= 'z') ) {
-            	        input.consume();
-            	    }
-            	    else {
-            	        MismatchedSetException mse = new MismatchedSetException(null,input);
-            	        recover(mse);
-            	        throw mse;
-            	    }
-
-
-            	    }
-            	    break;
-
-            	default :
-            	    break loop9;
-                }
-            } while (true);
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "ID"
-
-    // $ANTLR start "LONG"
-    public final void mLONG() throws RecognitionException {
-        try {
-            int _type = LONG;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:149:6: ( ( '-' )? ( '0' .. '9' )+ )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:149:8: ( '-' )? ( '0' .. '9' )+
-            {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:149:8: ( '-' )?
-            int alt10=2;
-            switch ( input.LA(1) ) {
-                case '-':
-                    {
-                    alt10=1;
-                    }
-                    break;
-            }
-
-            switch (alt10) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:149:9: '-'
-                    {
-                    match('-'); 
-
-                    }
-                    break;
-
-            }
-
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:149:15: ( '0' .. '9' )+
-            int cnt11=0;
-            loop11:
-            do {
-                int alt11=2;
-                switch ( input.LA(1) ) {
-                case '0':
-                case '1':
-                case '2':
-                case '3':
-                case '4':
-                case '5':
-                case '6':
-                case '7':
-                case '8':
-                case '9':
-                    {
-                    alt11=1;
-                    }
-                    break;
-
-                }
-
-                switch (alt11) {
-            	case 1 :
-            	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:
-            	    {
-            	    if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
-            	        input.consume();
-            	    }
-            	    else {
-            	        MismatchedSetException mse = new MismatchedSetException(null,input);
-            	        recover(mse);
-            	        throw mse;
-            	    }
-
-
-            	    }
-            	    break;
-
-            	default :
-            	    if ( cnt11 >= 1 ) break loop11;
-                        EarlyExitException eee =
-                            new EarlyExitException(11, input);
-                        throw eee;
-                }
-                cnt11++;
-            } while (true);
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "LONG"
-
-    // $ANTLR start "FLOAT"
-    public final void mFLOAT() throws RecognitionException {
-        try {
-            int _type = FLOAT;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:153:5: ( ( '-' )? ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( EXPONENT )? | '.' ( '0' .. '9' )+ ( EXPONENT )? | ( '0' .. '9' )+ EXPONENT ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:153:8: ( '-' )? ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( EXPONENT )? | '.' ( '0' .. '9' )+ ( EXPONENT )? | ( '0' .. '9' )+ EXPONENT )
-            {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:153:8: ( '-' )?
-            int alt12=2;
-            switch ( input.LA(1) ) {
-                case '-':
-                    {
-                    alt12=1;
-                    }
-                    break;
-            }
-
-            switch (alt12) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:153:9: '-'
-                    {
-                    match('-'); 
-
-                    }
-                    break;
-
-            }
-
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:153:15: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( EXPONENT )? | '.' ( '0' .. '9' )+ ( EXPONENT )? | ( '0' .. '9' )+ EXPONENT )
-            int alt19=3;
-            alt19 = dfa19.predict(input);
-            switch (alt19) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:153:17: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( EXPONENT )?
-                    {
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:153:17: ( '0' .. '9' )+
-                    int cnt13=0;
-                    loop13:
-                    do {
-                        int alt13=2;
-                        switch ( input.LA(1) ) {
-                        case '0':
-                        case '1':
-                        case '2':
-                        case '3':
-                        case '4':
-                        case '5':
-                        case '6':
-                        case '7':
-                        case '8':
-                        case '9':
-                            {
-                            alt13=1;
-                            }
-                            break;
-
-                        }
-
-                        switch (alt13) {
-                    	case 1 :
-                    	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:
-                    	    {
-                    	    if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
-                    	        input.consume();
-                    	    }
-                    	    else {
-                    	        MismatchedSetException mse = new MismatchedSetException(null,input);
-                    	        recover(mse);
-                    	        throw mse;
-                    	    }
-
-
-                    	    }
-                    	    break;
-
-                    	default :
-                    	    if ( cnt13 >= 1 ) break loop13;
-                                EarlyExitException eee =
-                                    new EarlyExitException(13, input);
-                                throw eee;
-                        }
-                        cnt13++;
-                    } while (true);
-
-
-                    match('.'); 
-
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:153:33: ( '0' .. '9' )*
-                    loop14:
-                    do {
-                        int alt14=2;
-                        switch ( input.LA(1) ) {
-                        case '0':
-                        case '1':
-                        case '2':
-                        case '3':
-                        case '4':
-                        case '5':
-                        case '6':
-                        case '7':
-                        case '8':
-                        case '9':
-                            {
-                            alt14=1;
-                            }
-                            break;
-
-                        }
-
-                        switch (alt14) {
-                    	case 1 :
-                    	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:
-                    	    {
-                    	    if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
-                    	        input.consume();
-                    	    }
-                    	    else {
-                    	        MismatchedSetException mse = new MismatchedSetException(null,input);
-                    	        recover(mse);
-                    	        throw mse;
-                    	    }
-
-
-                    	    }
-                    	    break;
-
-                    	default :
-                    	    break loop14;
-                        }
-                    } while (true);
-
-
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:153:45: ( EXPONENT )?
-                    int alt15=2;
-                    switch ( input.LA(1) ) {
-                        case 'E':
-                        case 'e':
-                            {
-                            alt15=1;
-                            }
-                            break;
-                    }
-
-                    switch (alt15) {
-                        case 1 :
-                            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:153:45: EXPONENT
-                            {
-                            mEXPONENT(); 
-
-
-                            }
-                            break;
-
-                    }
-
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:154:9: '.' ( '0' .. '9' )+ ( EXPONENT )?
-                    {
-                    match('.'); 
-
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:154:13: ( '0' .. '9' )+
-                    int cnt16=0;
-                    loop16:
-                    do {
-                        int alt16=2;
-                        switch ( input.LA(1) ) {
-                        case '0':
-                        case '1':
-                        case '2':
-                        case '3':
-                        case '4':
-                        case '5':
-                        case '6':
-                        case '7':
-                        case '8':
-                        case '9':
-                            {
-                            alt16=1;
-                            }
-                            break;
-
-                        }
-
-                        switch (alt16) {
-                    	case 1 :
-                    	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:
-                    	    {
-                    	    if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
-                    	        input.consume();
-                    	    }
-                    	    else {
-                    	        MismatchedSetException mse = new MismatchedSetException(null,input);
-                    	        recover(mse);
-                    	        throw mse;
-                    	    }
-
-
-                    	    }
-                    	    break;
-
-                    	default :
-                    	    if ( cnt16 >= 1 ) break loop16;
-                                EarlyExitException eee =
-                                    new EarlyExitException(16, input);
-                                throw eee;
-                        }
-                        cnt16++;
-                    } while (true);
-
-
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:154:25: ( EXPONENT )?
-                    int alt17=2;
-                    switch ( input.LA(1) ) {
-                        case 'E':
-                        case 'e':
-                            {
-                            alt17=1;
-                            }
-                            break;
-                    }
-
-                    switch (alt17) {
-                        case 1 :
-                            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:154:25: EXPONENT
-                            {
-                            mEXPONENT(); 
-
-
-                            }
-                            break;
-
-                    }
-
-
-                    }
-                    break;
-                case 3 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:155:9: ( '0' .. '9' )+ EXPONENT
-                    {
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:155:9: ( '0' .. '9' )+
-                    int cnt18=0;
-                    loop18:
-                    do {
-                        int alt18=2;
-                        switch ( input.LA(1) ) {
-                        case '0':
-                        case '1':
-                        case '2':
-                        case '3':
-                        case '4':
-                        case '5':
-                        case '6':
-                        case '7':
-                        case '8':
-                        case '9':
-                            {
-                            alt18=1;
-                            }
-                            break;
-
-                        }
-
-                        switch (alt18) {
-                    	case 1 :
-                    	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:
-                    	    {
-                    	    if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
-                    	        input.consume();
-                    	    }
-                    	    else {
-                    	        MismatchedSetException mse = new MismatchedSetException(null,input);
-                    	        recover(mse);
-                    	        throw mse;
-                    	    }
-
-
-                    	    }
-                    	    break;
-
-                    	default :
-                    	    if ( cnt18 >= 1 ) break loop18;
-                                EarlyExitException eee =
-                                    new EarlyExitException(18, input);
-                                throw eee;
-                        }
-                        cnt18++;
-                    } while (true);
-
-
-                    mEXPONENT(); 
-
-
-                    }
-                    break;
-
-            }
-
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "FLOAT"
-
-    // $ANTLR start "STRING"
-    public final void mSTRING() throws RecognitionException {
-        try {
-            int _type = STRING;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:159:5: ( '\\'' ( ESC_SEQ |~ ( '\\\\' | '\\'' ) )* '\\'' )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:159:8: '\\'' ( ESC_SEQ |~ ( '\\\\' | '\\'' ) )* '\\''
-            {
-            match('\''); 
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:159:13: ( ESC_SEQ |~ ( '\\\\' | '\\'' ) )*
-            loop20:
-            do {
-                int alt20=3;
-                int LA20_0 = input.LA(1);
-
-                if ( (LA20_0=='\\') ) {
-                    alt20=1;
-                }
-                else if ( ((LA20_0 >= '\u0000' && LA20_0 <= '&')||(LA20_0 >= '(' && LA20_0 <= '[')||(LA20_0 >= ']' && LA20_0 <= '\uFFFF')) ) {
-                    alt20=2;
-                }
-
-
-                switch (alt20) {
-            	case 1 :
-            	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:159:15: ESC_SEQ
-            	    {
-            	    mESC_SEQ(); 
-
-
-            	    }
-            	    break;
-            	case 2 :
-            	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:159:25: ~ ( '\\\\' | '\\'' )
-            	    {
-            	    if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '&')||(input.LA(1) >= '(' && input.LA(1) <= '[')||(input.LA(1) >= ']' && input.LA(1) <= '\uFFFF') ) {
-            	        input.consume();
-            	    }
-            	    else {
-            	        MismatchedSetException mse = new MismatchedSetException(null,input);
-            	        recover(mse);
-            	        throw mse;
-            	    }
-
-
-            	    }
-            	    break;
-
-            	default :
-            	    break loop20;
-                }
-            } while (true);
-
-
-            match('\''); 
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "STRING"
-
-    // $ANTLR start "WS"
-    public final void mWS() throws RecognitionException {
-        try {
-            int _type = WS;
-            int _channel = DEFAULT_TOKEN_CHANNEL;
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:164:4: ( ( ' ' | '\\t' | '\\n' | '\\r' | '\\f' )+ )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:164:6: ( ' ' | '\\t' | '\\n' | '\\r' | '\\f' )+
-            {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:164:6: ( ' ' | '\\t' | '\\n' | '\\r' | '\\f' )+
-            int cnt21=0;
-            loop21:
-            do {
-                int alt21=2;
-                switch ( input.LA(1) ) {
-                case '\t':
-                case '\n':
-                case '\f':
-                case '\r':
-                case ' ':
-                    {
-                    alt21=1;
-                    }
-                    break;
-
-                }
-
-                switch (alt21) {
-            	case 1 :
-            	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:
-            	    {
-            	    if ( (input.LA(1) >= '\t' && input.LA(1) <= '\n')||(input.LA(1) >= '\f' && input.LA(1) <= '\r')||input.LA(1)==' ' ) {
-            	        input.consume();
-            	    }
-            	    else {
-            	        MismatchedSetException mse = new MismatchedSetException(null,input);
-            	        recover(mse);
-            	        throw mse;
-            	    }
-
-
-            	    }
-            	    break;
-
-            	default :
-            	    if ( cnt21 >= 1 ) break loop21;
-                        EarlyExitException eee =
-                            new EarlyExitException(21, input);
-                        throw eee;
-                }
-                cnt21++;
-            } while (true);
-
-
-            _channel=HIDDEN;
-
-            }
-
-            state.type = _type;
-            state.channel = _channel;
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "WS"
-
-    // $ANTLR start "TRUE"
-    public final void mTRUE() throws RecognitionException {
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:172:15: ( ( 'T' | 't' ) ( 'R' | 'r' ) ( 'U' | 'u' ) ( 'E' | 'e' ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:172:17: ( 'T' | 't' ) ( 'R' | 'r' ) ( 'U' | 'u' ) ( 'E' | 'e' )
-            {
-            if ( input.LA(1)=='T'||input.LA(1)=='t' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='R'||input.LA(1)=='r' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='U'||input.LA(1)=='u' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            }
-
-
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "TRUE"
-
-    // $ANTLR start "FALSE"
-    public final void mFALSE() throws RecognitionException {
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:174:16: ( ( 'F' | 'f' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'S' | 's' ) ( 'E' | 'e' ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:174:18: ( 'F' | 'f' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'S' | 's' ) ( 'E' | 'e' )
-            {
-            if ( input.LA(1)=='F'||input.LA(1)=='f' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='A'||input.LA(1)=='a' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='L'||input.LA(1)=='l' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='S'||input.LA(1)=='s' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            }
-
-
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "FALSE"
-
-    // $ANTLR start "EXPONENT"
-    public final void mEXPONENT() throws RecognitionException {
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:179:10: ( ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+ )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:179:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+
-            {
-            if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:179:22: ( '+' | '-' )?
-            int alt22=2;
-            switch ( input.LA(1) ) {
-                case '+':
-                case '-':
-                    {
-                    alt22=1;
-                    }
-                    break;
-            }
-
-            switch (alt22) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:
-                    {
-                    if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    }
-                    break;
-
-            }
-
-
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:179:33: ( '0' .. '9' )+
-            int cnt23=0;
-            loop23:
-            do {
-                int alt23=2;
-                switch ( input.LA(1) ) {
-                case '0':
-                case '1':
-                case '2':
-                case '3':
-                case '4':
-                case '5':
-                case '6':
-                case '7':
-                case '8':
-                case '9':
-                    {
-                    alt23=1;
-                    }
-                    break;
-
-                }
-
-                switch (alt23) {
-            	case 1 :
-            	    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:
-            	    {
-            	    if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
-            	        input.consume();
-            	    }
-            	    else {
-            	        MismatchedSetException mse = new MismatchedSetException(null,input);
-            	        recover(mse);
-            	        throw mse;
-            	    }
-
-
-            	    }
-            	    break;
-
-            	default :
-            	    if ( cnt23 >= 1 ) break loop23;
-                        EarlyExitException eee =
-                            new EarlyExitException(23, input);
-                        throw eee;
-                }
-                cnt23++;
-            } while (true);
-
-
-            }
-
-
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "EXPONENT"
-
-    // $ANTLR start "HEX_DIGIT"
-    public final void mHEX_DIGIT() throws RecognitionException {
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:182:11: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:
-            {
-            if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'F')||(input.LA(1) >= 'a' && input.LA(1) <= 'f') ) {
-                input.consume();
-            }
-            else {
-                MismatchedSetException mse = new MismatchedSetException(null,input);
-                recover(mse);
-                throw mse;
-            }
-
-
-            }
-
-
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "HEX_DIGIT"
-
-    // $ANTLR start "ESC_SEQ"
-    public final void mESC_SEQ() throws RecognitionException {
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:186:5: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | UNICODE_ESC | OCTAL_ESC )
-            int alt24=3;
-            switch ( input.LA(1) ) {
-            case '\\':
-                {
-                switch ( input.LA(2) ) {
-                case '\"':
-                case '\'':
-                case '\\':
-                case 'b':
-                case 'f':
-                case 'n':
-                case 'r':
-                case 't':
-                    {
-                    alt24=1;
-                    }
-                    break;
-                case 'u':
-                    {
-                    alt24=2;
-                    }
-                    break;
-                case '0':
-                case '1':
-                case '2':
-                case '3':
-                case '4':
-                case '5':
-                case '6':
-                case '7':
-                    {
-                    alt24=3;
-                    }
-                    break;
-                default:
-                    NoViableAltException nvae =
-                        new NoViableAltException("", 24, 1, input);
-
-                    throw nvae;
-
-                }
-
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 24, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt24) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:186:9: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' )
-                    {
-                    match('\\'); 
-
-                    if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:187:9: UNICODE_ESC
-                    {
-                    mUNICODE_ESC(); 
-
-
-                    }
-                    break;
-                case 3 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:188:9: OCTAL_ESC
-                    {
-                    mOCTAL_ESC(); 
-
-
-                    }
-                    break;
-
-            }
-
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "ESC_SEQ"
-
-    // $ANTLR start "OCTAL_ESC"
-    public final void mOCTAL_ESC() throws RecognitionException {
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:193:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
-            int alt25=3;
-            switch ( input.LA(1) ) {
-            case '\\':
-                {
-                switch ( input.LA(2) ) {
-                case '0':
-                case '1':
-                case '2':
-                case '3':
-                    {
-                    switch ( input.LA(3) ) {
-                    case '0':
-                    case '1':
-                    case '2':
-                    case '3':
-                    case '4':
-                    case '5':
-                    case '6':
-                    case '7':
-                        {
-                        switch ( input.LA(4) ) {
-                        case '0':
-                        case '1':
-                        case '2':
-                        case '3':
-                        case '4':
-                        case '5':
-                        case '6':
-                        case '7':
-                            {
-                            alt25=1;
-                            }
-                            break;
-                        default:
-                            alt25=2;
-                        }
-
-                        }
-                        break;
-                    default:
-                        alt25=3;
-                    }
-
-                    }
-                    break;
-                case '4':
-                case '5':
-                case '6':
-                case '7':
-                    {
-                    switch ( input.LA(3) ) {
-                    case '0':
-                    case '1':
-                    case '2':
-                    case '3':
-                    case '4':
-                    case '5':
-                    case '6':
-                    case '7':
-                        {
-                        alt25=2;
-                        }
-                        break;
-                    default:
-                        alt25=3;
-                    }
-
-                    }
-                    break;
-                default:
-                    NoViableAltException nvae =
-                        new NoViableAltException("", 25, 1, input);
-
-                    throw nvae;
-
-                }
-
-                }
-                break;
-            default:
-                NoViableAltException nvae =
-                    new NoViableAltException("", 25, 0, input);
-
-                throw nvae;
-
-            }
-
-            switch (alt25) {
-                case 1 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:193:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
-                    {
-                    match('\\'); 
-
-                    if ( (input.LA(1) >= '0' && input.LA(1) <= '3') ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    }
-                    break;
-                case 2 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:194:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
-                    {
-                    match('\\'); 
-
-                    if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    }
-                    break;
-                case 3 :
-                    // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:195:9: '\\\\' ( '0' .. '7' )
-                    {
-                    match('\\'); 
-
-                    if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
-                        input.consume();
-                    }
-                    else {
-                        MismatchedSetException mse = new MismatchedSetException(null,input);
-                        recover(mse);
-                        throw mse;
-                    }
-
-
-                    }
-                    break;
-
-            }
-
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "OCTAL_ESC"
-
-    // $ANTLR start "UNICODE_ESC"
-    public final void mUNICODE_ESC() throws RecognitionException {
-        try {
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:200:5: ( '\\\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT )
-            // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:200:9: '\\\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
-            {
-            match('\\'); 
-
-            match('u'); 
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            mHEX_DIGIT(); 
-
-
-            }
-
-
-        }
-        finally {
-        	// do for sure before leaving
-        }
-    }
-    // $ANTLR end "UNICODE_ESC"
-
-    public void mTokens() throws RecognitionException {
-        // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:8: ( T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | LT | LTE | EQ | GT | GTE | BOOLEAN | AND | OR | NOT | ASC | DESC | CONTAINS | WITHIN | OF | UUID | ID | LONG | FLOAT | STRING | WS )
-        int alt26=30;
-        alt26 = dfa26.predict(input);
-        switch (alt26) {
-            case 1 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:10: T__31
-                {
-                mT__31(); 
-
-
-                }
-                break;
-            case 2 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:16: T__32
-                {
-                mT__32(); 
-
-
-                }
-                break;
-            case 3 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:22: T__33
-                {
-                mT__33(); 
-
-
-                }
-                break;
-            case 4 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:28: T__34
-                {
-                mT__34(); 
-
-
-                }
-                break;
-            case 5 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:34: T__35
-                {
-                mT__35(); 
-
-
-                }
-                break;
-            case 6 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:40: T__36
-                {
-                mT__36(); 
-
-
-                }
-                break;
-            case 7 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:46: T__37
-                {
-                mT__37(); 
-
-
-                }
-                break;
-            case 8 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:52: T__38
-                {
-                mT__38(); 
-
-
-                }
-                break;
-            case 9 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:58: T__39
-                {
-                mT__39(); 
-
-
-                }
-                break;
-            case 10 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:64: T__40
-                {
-                mT__40(); 
-
-
-                }
-                break;
-            case 11 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:70: LT
-                {
-                mLT(); 
-
-
-                }
-                break;
-            case 12 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:73: LTE
-                {
-                mLTE(); 
-
-
-                }
-                break;
-            case 13 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:77: EQ
-                {
-                mEQ(); 
-
-
-                }
-                break;
-            case 14 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:80: GT
-                {
-                mGT(); 
-
-
-                }
-                break;
-            case 15 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:83: GTE
-                {
-                mGTE(); 
-
-
-                }
-                break;
-            case 16 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:87: BOOLEAN
-                {
-                mBOOLEAN(); 
-
-
-                }
-                break;
-            case 17 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:95: AND
-                {
-                mAND(); 
-
-
-                }
-                break;
-            case 18 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:99: OR
-                {
-                mOR(); 
-
-
-                }
-                break;
-            case 19 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:102: NOT
-                {
-                mNOT(); 
-
-
-                }
-                break;
-            case 20 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:106: ASC
-                {
-                mASC(); 
-
-
-                }
-                break;
-            case 21 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:110: DESC
-                {
-                mDESC(); 
-
-
-                }
-                break;
-            case 22 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:115: CONTAINS
-                {
-                mCONTAINS(); 
-
-
-                }
-                break;
-            case 23 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:124: WITHIN
-                {
-                mWITHIN(); 
-
-
-                }
-                break;
-            case 24 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:131: OF
-                {
-                mOF(); 
-
-
-                }
-                break;
-            case 25 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:134: UUID
-                {
-                mUUID(); 
-
-
-                }
-                break;
-            case 26 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:139: ID
-                {
-                mID(); 
-
-
-                }
-                break;
-            case 27 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:142: LONG
-                {
-                mLONG(); 
-
-
-                }
-                break;
-            case 28 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:147: FLOAT
-                {
-                mFLOAT(); 
-
-
-                }
-                break;
-            case 29 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:153: STRING
-                {
-                mSTRING(); 
-
-
-                }
-                break;
-            case 30 :
-                // org/apache/usergrid/persistence/index/query/tree/CpQueryFilter.g:1:160: WS
-                {
-                mWS(); 
-
-
-                }
-                break;
-
-        }
-
-    }
-
-
-    protected DFA19 dfa19 = new DFA19(this);
-    protected DFA26 dfa26 = new DFA26(this);
-    static final String DFA19_eotS =
-        "\5\uffff";
-    static final String DFA19_eofS =
-        "\5\uffff";
-    static final String DFA19_minS =
-        "\2\56\3\uffff";
-    static final String DFA19_maxS =
-        "\1\71\1\145\3\uffff";
-    static final String DFA19_acceptS =
-        "\2\uffff\1\2\1\1\1\3";
-    static final String DFA19_specialS =
-        "\5\uffff}>";
-    static final String[] DFA19_transitionS = {
-            "\1\2\1\uffff\12\1",
-            "\1\3\1\uffff\12\1\13\uffff\1\4\37\uffff\1\4",
-            "",
-            "",
-            ""
-    };
-
-    static final short[] DFA19_eot = DFA.unpackEncodedString(DFA19_eotS);
-    static final short[] DFA19_eof = DFA.unpackEncodedString(DFA19_eofS);
-    static final char[] DFA19_min = DFA.unpackEncodedStringToUnsignedChars(DFA19_minS);
-    static final char[] DFA19_max = DFA.unpackEncodedStringToUnsignedChars(DFA19_maxS);
-    static final short[] DFA19_accept = DFA.unpackEncodedString(DFA19_acceptS);
-    static final short[] DFA19_special = DFA.unpackEncodedString(DFA19_specialS);
-    static final short[][] DFA19_transition;
-
-    static {
-        int numStates = DFA19_transitionS.length;
-        DFA19_transition = new short[numStates][];
-        for (int i=0; i<numStates; i++) {
-            DFA19_transition[i] = DFA.unpackEncodedString(DFA19_transitionS[i]);
-        }
-    }
-
-    class DFA19 extends DFA {
-
-        public DFA19(BaseRecognizer recognizer) {
-            this.recognizer = recognizer;
-            this.decisionNumber = 19;
-            this.eot = DFA19_eot;
-            this.eof = DFA19_eof;
-            this.min = DFA19_min;
-            this.max = DFA19_max;
-            this.accept = DFA19_accept;
-            this.special = DFA19_special;
-            this.transition = DFA19_transition;
-        }
-        public String getDescription() {
-            return "153:15: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( EXPONENT )? | '.' ( '0' .. '9' )+ ( EXPONENT )? | ( '0' .. '9' )+ EXPONENT )";
-        }
-    }
-    static final String DFA26_eotS =
-        "\6\uffff\3\35\2\uffff\1\51\1\35\1\uffff\1\35\1\56\4\35\1\uffff\1"+
-        "\35\1\uffff\5\35\1\67\5\uffff\2\26\1\75\3\35\2\uffff\1\51\1\15\1"+
-        "\35\2\uffff\1\56\7\35\1\uffff\1\67\2\uffff\1\67\1\35\1\uffff\3\35"+
-        "\1\50\1\35\1\55\2\35\1\24\1\125\1\126\2\35\1\67\1\uffff\1\37\5\35"+
-        "\1\141\1\35\2\uffff\1\143\1\35\1\67\1\uffff\1\37\2\35\1\152\2\35"+
-        "\1\uffff\1\141\1\uffff\1\35\1\67\1\uffff\1\37\1\uffff\1\161\1\uffff"+
-        "\1\162\2\35\1\67\1\uffff\1\37\2\uffff\2\35\1\67\1\uffff\1\37\1\35"+
-        "\1\176\1\67\1\uffff\1\37\1\35\2\uffff\1\35\1\37\1\35\1\37\1\35\1"+
-        "\37\1\35\1\37\26\35\1\72";
-    static final String DFA26_eofS =
-        "\u009f\uffff";
-    static final String DFA26_minS =
-        "\1\11\5\uffff\1\106\1\145\1\111\2\uffff\1\75\1\164\1\uffff\1\60"+
-        "\1\75\1\164\1\122\2\60\1\uffff\1\106\1\uffff\1\117\2\60\1\111\1"+
-        "\60\1\56\1\uffff\1\56\3\uffff\3\55\1\154\1\145\1\124\2\uffff\2\55"+
-        "\1\60\2\uffff\1\55\1\125\1\60\1\104\1\103\1\124\1\60\1\116\1\uffff"+
-        "\1\56\1\53\1\uffff\1\56\1\145\1\uffff\1\145\1\162\1\110\1\55\1\60"+
-        "\1\55\1\105\1\123\3\55\1\103\1\124\1\56\1\53\1\60\1\162\1\143\1"+
-        "\145\1\111\1\60\1\55\1\105\2\uffff\1\55\1\101\1\56\1\53\1\60\1\40"+
-        "\1\164\1\55\1\116\1\60\1\uffff\1\55\1\uffff\1\111\1\56\1\53\1\60"+
-        "\1\uffff\1\55\1\uffff\1\55\1\60\1\116\1\56\1\53\1\60\2\uffff\1\60"+
-        "\1\123\1\56\1\53\1\60\3\55\1\53\1\55\1\60\1\uffff\7\60\2\55\4\60"+
-        "\1\5

<TRUNCATED>

[3/6] git commit: Add ArrayField to Mvcc serialization test and default constructor to ArrayField.

Posted by sn...@apache.org.
Add ArrayField to Mvcc serialization test and default constructor to ArrayField.


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/9b53e164
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/9b53e164
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/9b53e164

Branch: refs/heads/two-dot-o
Commit: 9b53e16453cda51df9a7c9463453dff8dd47eb6a
Parents: 718c0fe
Author: Dave Johnson <dm...@apigee.com>
Authored: Wed Aug 27 13:07:02 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Wed Aug 27 13:07:02 2014 -0400

----------------------------------------------------------------------
 .../usergrid/persistence/GeoQueryOrTest.java    | 111 -------------------
 ...MvccEntitySerializationStrategyImplTest.java |  13 ++-
 .../persistence/model/field/ArrayField.java     |   4 +
 .../persistence/model/field/SetField.java       |   1 +
 4 files changed, 16 insertions(+), 113 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b53e164/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryOrTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryOrTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryOrTest.java
deleted file mode 100644
index 7acc4f7..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryOrTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.
- */
-package org.apache.usergrid.persistence;
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.persistence.geo.model.Point;
-import org.apache.usergrid.persistence.index.query.Query;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-
-@Concurrent()
-public class GeoQueryOrTest extends AbstractCoreIT {
-    private static final Logger LOG = LoggerFactory.getLogger( GeoQueryOrTest.class );
-
-
-    public GeoQueryOrTest() {
-        super();
-    }
-
-
-    @Test
-    public void testGeoQueryWithOr() throws Exception {
-
-        LOG.info( "GeoIT.testGeoQueryWithOr" );
-
-        UUID applicationId = setup.createApplication( "testOrganization", "testGeoQueryWithOr" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
-        assertNotNull( em );
-
-        // create two users at a location
-
-        Map<String, Object> properties = new LinkedHashMap<String, Object>() {{
-            put( "username", "ed" );
-            put( "employer", "Apigee" );
-            put( "email", "ed@example.com" );
-            put( "location", new LinkedHashMap<String, Object>() {{
-                put("latitude", 37.776753 );
-                put("longitude", -122.407846 );
-            }} ); 
-        }};
-
-        Entity user1 = em.create( "user", properties );
-        assertNotNull( user1 );
-
-        properties = new LinkedHashMap<String, Object>() {{
-            put( "username", "fred" );
-            put( "employer", "Microsoft" );
-            put( "email", "fred@example.com" );
-            put( "location", new LinkedHashMap<String, Object>() {{
-                put("latitude", 37.776753 );
-                put("longitude", -122.407846 );
-            }} ); 
-        }};
-
-        Entity user2 = em.create( "user", properties );
-        assertNotNull( user2 );
-
-        em.refreshIndex();
-
-        // define center point about 300m from that location
-        Point center = new Point( 37.774277, -122.404744 );
-
-        Query query = Query.fromQL( "select * where location within 400 of " 
-                                    + center.getLat() + "," + center.getLon());
-        Results listResults = em.searchCollection( em.getApplicationRef(), "users", query );
-        assertEquals( 2, listResults.size() );
-
-        query = Query.fromQL( "select * where employer='Apigee' or location within 100 of " 
-                                    + center.getLat() + "," + center.getLon());
-        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
-
-        // no results because geo filter applied after query even in the case or 'or'
-        assertEquals( 0, listResults.size() );
-
-        query = Query.fromQL( "select * where employer='Apigee' or location within 400 of " 
-                                    + center.getLat() + "," + center.getLon());
-        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
-
-        // only one result because geo filter applied after query even in the case or 'or'
-        assertEquals( 1, listResults.size() );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b53e164/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
index ebb77e0..6780115 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
@@ -67,6 +67,7 @@ import static junit.framework.TestCase.assertFalse;
 import static junit.framework.TestCase.assertNotNull;
 import static junit.framework.TestCase.assertNull;
 import static junit.framework.TestCase.assertTrue;
+import org.apache.usergrid.persistence.model.field.ArrayField;
 import static org.mockito.Mockito.mock;
 
 
@@ -142,13 +143,17 @@ public class MvccEntitySerializationStrategyImplTest {
         StringField stringField = new StringField( "name", "test" );
         UUIDField uuidField = new UUIDField( "uuid", UUIDGenerator.newTimeUUID() );
 
+        ArrayField arrayField = new ArrayField("array");
+        arrayField.add("item1");
+        arrayField.add("item2");
+
         entity.setField( boolField );
         entity.setField( doubleField );
         entity.setField( intField );
         entity.setField( longField );
         entity.setField( stringField );
         entity.setField( uuidField );
-
+        entity.setField( arrayField );
 
         MvccEntity saved = new MvccEntityImpl( id, version, MvccEntity.Status.COMPLETE, Optional.of( entity ) );
 
@@ -190,6 +195,10 @@ public class MvccEntitySerializationStrategyImplTest {
 
         assertEquals( uuidField, uuidFieldReturned );
 
+        Field<ArrayField> arrayFieldReturned = returned.getEntity().get().getField( arrayField.getName() );
+
+        assertEquals( arrayField, arrayFieldReturned );
+
 
         Set<Field> results = new HashSet<Field>();
         results.addAll( returned.getEntity().get().getFields());
@@ -202,7 +211,7 @@ public class MvccEntitySerializationStrategyImplTest {
         assertTrue( results.contains( stringField ) );
         assertTrue( results.contains( uuidField ) );
 
-        assertEquals( 6, results.size() );
+        assertEquals( 7, results.size() );
 
 
         assertEquals( id, entity.getId() );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b53e164/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/ArrayField.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/ArrayField.java b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/ArrayField.java
index 0ec00a7..452eb49 100644
--- a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/ArrayField.java
+++ b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/ArrayField.java
@@ -36,6 +36,10 @@ public class ArrayField<T> extends ListField<T> {
         super( name, list );
     }
 
+    public ArrayField() {
+        super();
+    }
+
     /**
      * Add the value to the list
      */

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b53e164/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/SetField.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/SetField.java b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/SetField.java
index e68769a..f93c9db 100644
--- a/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/SetField.java
+++ b/stack/corepersistence/model/src/main/java/org/apache/usergrid/persistence/model/field/SetField.java
@@ -38,6 +38,7 @@ public class SetField<T> extends AbstractField<Set<T>> {
     }
 
     public SetField() {
+        super();
     }
 
     /**


[2/6] git commit: New GeoQueryOrTest to test using or in a geo query.

Posted by sn...@apache.org.
New GeoQueryOrTest to test using or in a geo query.


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/718c0fe0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/718c0fe0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/718c0fe0

Branch: refs/heads/two-dot-o
Commit: 718c0fe08a762e9b76e7f3ca2c6bde1b89399e5f
Parents: f22d67a
Author: Dave Johnson <dm...@apigee.com>
Authored: Tue Aug 26 16:12:32 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Tue Aug 26 16:12:32 2014 -0400

----------------------------------------------------------------------
 .../org/apache/usergrid/persistence/GeoIT.java  |   1 -
 .../usergrid/persistence/GeoQueryOrTest.java    | 111 +++++++++++++++++++
 2 files changed, 111 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/718c0fe0/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java
index 42e5c2b..36b288b 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java
@@ -30,7 +30,6 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.AbstractCoreIT;
 import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.persistence.geo.EntityLocationRef;
 import org.apache.usergrid.persistence.geo.model.Point;
 import org.apache.usergrid.persistence.index.query.Query;
 import org.apache.usergrid.utils.MapUtils;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/718c0fe0/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryOrTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryOrTest.java b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryOrTest.java
new file mode 100644
index 0000000..7acc4f7
--- /dev/null
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoQueryOrTest.java
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+package org.apache.usergrid.persistence;
+
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.AbstractCoreIT;
+import org.apache.usergrid.cassandra.Concurrent;
+import org.apache.usergrid.persistence.geo.model.Point;
+import org.apache.usergrid.persistence.index.query.Query;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+
+@Concurrent()
+public class GeoQueryOrTest extends AbstractCoreIT {
+    private static final Logger LOG = LoggerFactory.getLogger( GeoQueryOrTest.class );
+
+
+    public GeoQueryOrTest() {
+        super();
+    }
+
+
+    @Test
+    public void testGeoQueryWithOr() throws Exception {
+
+        LOG.info( "GeoIT.testGeoQueryWithOr" );
+
+        UUID applicationId = setup.createApplication( "testOrganization", "testGeoQueryWithOr" );
+        assertNotNull( applicationId );
+
+        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        assertNotNull( em );
+
+        // create two users at a location
+
+        Map<String, Object> properties = new LinkedHashMap<String, Object>() {{
+            put( "username", "ed" );
+            put( "employer", "Apigee" );
+            put( "email", "ed@example.com" );
+            put( "location", new LinkedHashMap<String, Object>() {{
+                put("latitude", 37.776753 );
+                put("longitude", -122.407846 );
+            }} ); 
+        }};
+
+        Entity user1 = em.create( "user", properties );
+        assertNotNull( user1 );
+
+        properties = new LinkedHashMap<String, Object>() {{
+            put( "username", "fred" );
+            put( "employer", "Microsoft" );
+            put( "email", "fred@example.com" );
+            put( "location", new LinkedHashMap<String, Object>() {{
+                put("latitude", 37.776753 );
+                put("longitude", -122.407846 );
+            }} ); 
+        }};
+
+        Entity user2 = em.create( "user", properties );
+        assertNotNull( user2 );
+
+        em.refreshIndex();
+
+        // define center point about 300m from that location
+        Point center = new Point( 37.774277, -122.404744 );
+
+        Query query = Query.fromQL( "select * where location within 400 of " 
+                                    + center.getLat() + "," + center.getLon());
+        Results listResults = em.searchCollection( em.getApplicationRef(), "users", query );
+        assertEquals( 2, listResults.size() );
+
+        query = Query.fromQL( "select * where employer='Apigee' or location within 100 of " 
+                                    + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
+
+        // no results because geo filter applied after query even in the case or 'or'
+        assertEquals( 0, listResults.size() );
+
+        query = Query.fromQL( "select * where employer='Apigee' or location within 400 of " 
+                                    + center.getLat() + "," + center.getLon());
+        listResults = em.searchCollection( em.getApplicationRef(), "users", query );
+
+        // only one result because geo filter applied after query even in the case or 'or'
+        assertEquals( 1, listResults.size() );
+    }
+
+}