usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [38/50] [abbrv] incubator-usergrid git commit: Revert "fix for list types changing from string to int or whatever"
Date Thu, 19 Mar 2015 23:26:55 GMT
Revert "fix for list types changing from string to int or whatever"

This reverts commit e5cab76f8b8fc1e4a60ea23274e7a8a0cc79f759.


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

Branch: refs/heads/USERGRID-480
Commit: b09dc43526cd27dcf75fa09dc5c40a288ca30225
Parents: 762e43e
Author: Todd Nine <tnine@apigee.com>
Authored: Tue Mar 17 17:30:27 2015 -0600
Committer: Todd Nine <tnine@apigee.com>
Committed: Tue Mar 17 17:30:27 2015 -0600

----------------------------------------------------------------------
 .../index/impl/EsEntityIndexBatchImpl.java      |  14 ++-
 .../persistence/index/impl/IndexingUtils.java   | 109 +++++++++----------
 .../persistence/index/impl/EntityIndexTest.java |  38 +------
 3 files changed, 70 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b09dc435/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
index 4c32cc1..92312d2 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
@@ -56,7 +56,15 @@ import com.codahale.metrics.Timer;
 import rx.Observable;
 import rx.functions.Func1;
 
-import static org.apache.usergrid.persistence.index.impl.IndexingUtils.*;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.ANALYZED_STRING_PREFIX;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.BOOLEAN_PREFIX;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.ENTITYID_ID_FIELDNAME;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.ENTITY_CONTEXT_FIELDNAME;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.GEO_PREFIX;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.NUMBER_PREFIX;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.STRING_PREFIX;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.createContextName;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.createIndexDocId;
 
 
 public class EsEntityIndexBatchImpl implements EntityIndexBatch {
@@ -235,7 +243,7 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
 
             if ( f instanceof ListField ) {
                 List list = ( List ) field.getValue();
-                entityMap.put(LIST_PREFIX + field.getName().toLowerCase(),
+                entityMap.put( field.getName().toLowerCase(),
                         new ArrayList( processCollectionForMap( list ) ) );
 
                 if ( !list.isEmpty() ) {
@@ -247,7 +255,7 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
             }
             else if ( f instanceof ArrayField ) {
                 List list = ( List ) field.getValue();
-                entityMap.put(ARRAY_PREFIX + field.getName().toLowerCase(),
+                entityMap.put( field.getName().toLowerCase(),
                         new ArrayList( processCollectionForMap( list ) ) );
             }
             else if ( f instanceof SetField ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b09dc435/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexingUtils.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexingUtils.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexingUtils.java
index 41a4680..ffd98e9 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexingUtils.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexingUtils.java
@@ -34,9 +34,6 @@ public class IndexingUtils {
 
     public static final String STRING_PREFIX = "su_";
     public static final String ANALYZED_STRING_PREFIX = "sa_";
-    public static final String ARRAY_PREFIX = "ar_";
-    public static final String LIST_PREFIX = "li_";
-
     public static final String GEO_PREFIX = "go_";
     public static final String NUMBER_PREFIX = "nu_";
     public static final String BOOLEAN_PREFIX = "bu_";
@@ -156,75 +153,75 @@ public class IndexingUtils {
 
                     /**  add routing  "_routing":{ "required":false,  "path":"ug_entityId"
**/
                      .startObject("_routing").field("required",true).field("path",ENTITYID_ID_FIELDNAME).endObject()
-            .startArray("dynamic_templates")
+                     .startArray("dynamic_templates")
                         // we need most specific mappings first since it's a stop on match
algorithm
 
-            .startObject()
+                        .startObject()
 
-            .startObject("entity_id_template" )
-            .field("match", IndexingUtils.ENTITYID_ID_FIELDNAME )
-            .field("match_mapping_type", "string" )
-            .startObject( "mapping").field("type", "string" )
-            .field("index", "not_analyzed" )
-            .endObject()
-            .endObject()
-            .endObject()
+                            .startObject( "entity_id_template" )
+                                .field( "match", IndexingUtils.ENTITYID_ID_FIELDNAME )
+                                    .field( "match_mapping_type", "string" )
+                                            .startObject( "mapping" ).field( "type", "string"
)
+                                                .field( "index", "not_analyzed" )
+                                            .endObject()
+                                    .endObject()
+                                .endObject()
 
-            .startObject()
-            .startObject("entity_context_template" )
+                            .startObject()
+                            .startObject( "entity_context_template" )
                                 .field( "match", IndexingUtils.ENTITY_CONTEXT_FIELDNAME )
-            .field("match_mapping_type", "string" )
-            .startObject( "mapping" )
+                                .field( "match_mapping_type", "string" )
+                                    .startObject( "mapping" )
                                         .field( "type", "string" )
-            .field("index", "not_analyzed").endObject()
-            .endObject()
-            .endObject()
-
-            .startObject()
-            .startObject("entity_version_template" )
-            .field("match", IndexingUtils.ENTITY_VERSION_FIELDNAME )
-            .field("match_mapping_type", "string" )
-            .startObject( "mapping").field("type", "long" )
-            .endObject()
-            .endObject()
-            .endObject()
+                                        .field( "index", "not_analyzed" ).endObject()
+                                    .endObject()
+                            .endObject()
+
+                            .startObject()
+                            .startObject( "entity_version_template" )
+                                .field( "match", IndexingUtils.ENTITY_VERSION_FIELDNAME )
+                                        .field( "match_mapping_type", "string" )
+                                            .startObject( "mapping" ).field( "type", "long"
)
+                                            .endObject()
+                                        .endObject()
+                                    .endObject()
 
                             // any string with field name that starts with sa_ gets analyzed
-            .startObject()
-            .startObject("template_1" )
+                            .startObject()
+                                .startObject( "template_1" )
                                     .field( "match", ANALYZED_STRING_PREFIX + "*" )
-            .field("match_mapping_type", "string" ).startObject( "mapping" )
+                                    .field( "match_mapping_type", "string" ).startObject(
"mapping" )
                                     .field( "type", "string" )
-            .field("index", "analyzed" )
-            .endObject()
-            .endObject()
+                                    .field( "index", "analyzed" )
+                                .endObject()
+                            .endObject()
 
-            .endObject()
+                        .endObject()
 
                         // all other strings are not analyzed
-            .startObject()
-            .startObject("template_2" )
+                        .startObject()
+                            .startObject( "template_2" )
                                 //todo, should be string prefix, remove 2 field mapping
-            .field("match", "*" )
-            .field("match_mapping_type", "string" )
-            .startObject( "mapping" )
-            .field("type", "string" )
-            .field("index", "not_analyzed" )
-            .endObject()
-            .endObject()
-            .endObject()
+                                .field( "match", "*" )
+                                .field( "match_mapping_type", "string" )
+                                .startObject( "mapping" )
+                                    .field( "type", "string" )
+                                        .field( "index", "not_analyzed" )
+                                .endObject()
+                            .endObject()
+                        .endObject()
 
                         // fields names starting with go_ get geo-indexed
-            .startObject()
-            .startObject("template_3" )
-            .field("match", GEO_PREFIX + "location" )
-            .startObject( "mapping" )
-            .field("type", "geo_point" )
-            .endObject()
-            .endObject()
-            .endObject()
-
-            .endArray()
+                        .startObject()
+                            .startObject( "template_3" )
+                                .field( "match", GEO_PREFIX + "location" )
+                                    .startObject( "mapping" )
+            .field( "type", "geo_point" )
+                                    .endObject()
+                            .endObject()
+                        .endObject()
+
+                    .endArray()
 
             .endObject();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b09dc435/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
index 9cb5297..ca9bf79 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
@@ -26,7 +26,9 @@ import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.usergrid.persistence.core.guice.MigrationManagerRule;
 import org.apache.usergrid.persistence.index.*;
-import org.apache.usergrid.persistence.model.field.*;
+import org.apache.usergrid.persistence.model.field.ArrayField;
+import org.apache.usergrid.persistence.model.field.EntityObjectField;
+import org.apache.usergrid.persistence.model.field.UUIDField;
 import org.apache.usergrid.persistence.model.field.value.EntityObject;
 import org.junit.Ignore;
 import org.junit.Rule;
@@ -49,6 +51,7 @@ import org.apache.usergrid.persistence.index.utils.UUIDUtils;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.entity.SimpleId;
+import org.apache.usergrid.persistence.model.field.StringField;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 
 import com.fasterxml.jackson.core.type.TypeReference;
@@ -96,7 +99,7 @@ public class EntityIndexTest extends BaseIT {
     }
 
     @Test
-//    @Ignore("this is a problem i will work on when i can breathe")
+    @Ignore("this is a problem i will work on when i can breathe")
     public void testIndexVariations() throws IOException {
         Id appId = new SimpleId( "application" );
 
@@ -116,8 +119,6 @@ public class EntityIndexTest extends BaseIT {
         batch.index(indexScope, entity);
         batch.execute().get();
 
-        entity = new Entity( entityType );
-        entity.setField(new UUIDField(IndexingUtils.ENTITYID_ID_FIELDNAME, UUID.randomUUID()));
         EntityUtils.setVersion(entity, UUIDGenerator.newTimeUUID());
         List<String> list = new ArrayList<>();
         list.add("test");
@@ -125,9 +126,6 @@ public class EntityIndexTest extends BaseIT {
         batch.index(indexScope, entity);
         batch.execute().get();
 
-
-        entity = new Entity( entityType );
-        entity.setField(new UUIDField(IndexingUtils.ENTITYID_ID_FIELDNAME, UUID.randomUUID()));
         EntityUtils.setVersion(entity, UUIDGenerator.newTimeUUID());
         EntityObject testObj = new EntityObject();
         testObj.setField(new StringField("test","testFiedl"));
@@ -135,32 +133,9 @@ public class EntityIndexTest extends BaseIT {
         batch.index(indexScope, entity);
         batch.execute().get();
 
-        entity = new Entity( entityType );
-        entity.setField(new UUIDField(IndexingUtils.ENTITYID_ID_FIELDNAME, UUID.randomUUID()));
-        EntityUtils.setVersion(entity, UUIDGenerator.newTimeUUID());
-        List<Integer> listint = new ArrayList<>();
-        listint.add(0);
-        entity.setField(new ArrayField<Integer>("testfield", listint));
-        batch.index(indexScope, entity);
-        batch.execute().get();
-
-        entity = new Entity( entityType );
-        entity.setField(new UUIDField(IndexingUtils.ENTITYID_ID_FIELDNAME, UUID.randomUUID()));
-        EntityUtils.setVersion(entity, UUIDGenerator.newTimeUUID());
-        List<EntityObject> listObj = new ArrayList<>();
-        EntityObject listObjField = new EntityObject();
-        listObjField.setField(new StringField("testasf","somevalue"));
-        listObj.add(listObjField);
-        listObjField = new EntityObject();
-        listObjField.setField(new IntegerField("testasf",0));
-        listObj.add(listObjField);
-        entity.setField(new ArrayField<EntityObject>("testfield", listObj));
-        batch.index(indexScope, entity);
-        batch.execute().get();
-
         entityIndex.refresh();
-        testQuery(indexScope, searchTypes, entityIndex, "select *", 5);
 
+        testQueries( indexScope, searchTypes,  entityIndex );
     }
 
     @Test
@@ -288,7 +263,6 @@ public class EntityIndexTest extends BaseIT {
         entityIndex.refresh();
 
         //Hilda Youn
-
         testQuery(indexScope, searchTypes, entityIndex, "name = 'Bowers Oneil'", 0);
 
     }


Mime
View raw message