usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [1/2] incubator-usergrid git commit: add old type mapping to queries
Date Mon, 23 Mar 2015 17:16:54 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-501 [created] 1a61e0eec


add old type mapping to queries


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

Branch: refs/heads/USERGRID-501
Commit: cc779b24c6e8d19d6a20da85d2d625d8407b35eb
Parents: 8fe7267
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Mon Mar 23 10:53:20 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Mon Mar 23 10:53:20 2015 -0600

----------------------------------------------------------------------
 .../apache/usergrid/persistence/index/SearchType.java  | 10 ++++++----
 .../apache/usergrid/persistence/index/SearchTypes.java |  3 ++-
 .../persistence/index/impl/EsEntityIndexBatchImpl.java | 13 ++++++++-----
 .../usergrid/persistence/index/impl/IndexingUtils.java |  2 ++
 4 files changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cc779b24/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/SearchType.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/SearchType.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/SearchType.java
index 5501c09..c039360 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/SearchType.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/SearchType.java
@@ -40,10 +40,12 @@ public class SearchType{
         return new SearchType( id.getType() );
     }
 
-
-
     public String getTypeName(ApplicationScope applicationScope) {
-        final String typeName =  IndexingUtils.getType(applicationScope, type);
-        return typeName;
+            return  IndexingUtils.getType(applicationScope, type);
+    }
+
+    public String[] getTypeNames(ApplicationScope applicationScope) {
+        final String[] typeNames =   new String[]{type , IndexingUtils.getType(applicationScope,
type)};
+        return typeNames;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cc779b24/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/SearchTypes.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/SearchTypes.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/SearchTypes.java
index 1a97da2..9970c62 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/SearchTypes.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/SearchTypes.java
@@ -42,10 +42,11 @@ public class SearchTypes {
 
 
     public String[] getTypeNames(ApplicationScope applicationScope) {
-        String[] typeNames = new String[types.length];
+        String[] typeNames = new String[types.length*2];
         int i =0 ;
         for(String type : types){
             typeNames[i++] = IndexingUtils.getType(applicationScope,type);
+            typeNames[i++] = type;
         }
         return typeNames;
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cc779b24/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 90b8e35..3b65c74 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
@@ -159,8 +159,11 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
             indexes = new String[]{indexIdentifier.getIndex(null)};
         }
 
-        container.addDeIndexRequest( new DeIndexRequest( indexes, entityType.getTypeName(applicationScope),
indexId ) );
 
+        String[] typeNames = entityType.getTypeNames(applicationScope);
+        for(String type : typeNames) {
+            container.addDeIndexRequest(new DeIndexRequest(indexes, type, indexId));
+        }
         log.debug("Deindexed Entity with index id " + indexId);
 
         return this;
@@ -242,12 +245,12 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
 
             if ( f instanceof ArrayField ) {
                 List list = ( List ) field.getValue();
-                entityMap.put( field.getName().toLowerCase(),
+                entityMap.put( ARRAY_PREFIX + field.getName().toLowerCase(),
                         new ArrayList( processCollectionForMap( list ) ) );
             }
             else if ( f instanceof ListField ) {
                            List list = ( List ) field.getValue();
-                           entityMap.put( field.getName().toLowerCase(),
+                           entityMap.put(ARRAY_PREFIX + field.getName().toLowerCase(),
                                    new ArrayList( processCollectionForMap( list ) ) );
 
                            if ( !list.isEmpty() ) {
@@ -259,12 +262,12 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
                        }
             else if ( f instanceof SetField ) {
                 Set set = ( Set ) field.getValue();
-                entityMap.put( field.getName().toLowerCase(),
+                entityMap.put(SET_PREFIX+ field.getName().toLowerCase(),
                         new ArrayList( processCollectionForMap( set ) ) );
             }
             else if ( f instanceof EntityObjectField ) {
                 EntityObject eo = ( EntityObject ) field.getValue();
-                entityMap.put( field.getName().toLowerCase(), entityToMap(eo) ); // recursion
+                entityMap.put(EO_PREFIX + field.getName().toLowerCase(), entityToMap(eo)
); // recursion
             }
             else if ( f instanceof StringField ) {
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cc779b24/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 c365ff4..2fb56d1 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
@@ -40,6 +40,8 @@ public class IndexingUtils {
 
     public static final String BOOLEAN_PREFIX = "bu_";
     public static final String ARRAY_PREFIX = "ar_";
+    public static final String SET_PREFIX = "set_";
+    public static final String EO_PREFIX = "eo_";
 
     public static final String SPLITTER = "\\__";
 


Mime
View raw message