usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject [08/26] usergrid git commit: Minor refactoring and formatting changes.
Date Fri, 03 Jun 2016 14:45:58 GMT
Minor refactoring and formatting changes.


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

Branch: refs/heads/release-2.1.1
Commit: e9e7c39c46ca0b49b5891ee04bdac648e9777cee
Parents: 0b41620
Author: Dave Johnson <snoopdave@apache.org>
Authored: Fri May 20 16:00:21 2016 -0400
Committer: Dave Johnson <snoopdave@apache.org>
Committed: Fri May 20 16:00:21 2016 -0400

----------------------------------------------------------------------
 .../pipeline/read/search/CandidateEntityFilter.java     | 12 +++++++++---
 .../java/org/apache/usergrid/persistence/IndexIT.java   |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/e9e7c39c/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/CandidateEntityFilter.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/CandidateEntityFilter.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/CandidateEntityFilter.java
index e02e6c7..4aa6c8d 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/CandidateEntityFilter.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/pipeline/read/search/CandidateEntityFilter.java
@@ -163,17 +163,19 @@ public class CandidateEntityFilter extends AbstractFilter<FilterResult<Candidate
 
     private void nestedFieldSet( Map<String, Field> result, String[] parts, Map<String,
Field> fieldMap) {
         if ( parts.length > 0 ) {
+
             if ( fieldMap.containsKey( parts[0] )) {
                 Field field = fieldMap.get( parts[0] );
                 if ( field instanceof EntityObjectField ) {
                     EntityObjectField eof = (EntityObjectField)field;
-                    if ( result.get( parts[0] ) == null ) {
-                        result.put( parts[0], new EntityObjectField( parts[0], new EntityObject()
) );
-                    }
+                    result.putIfAbsent( parts[0], new EntityObjectField( parts[0], new EntityObject()
) );
+
+                    // recursion
                     nestedFieldSet(
                         ((EntityObjectField)result.get( parts[0] )).getValue().getFieldMap(),
                         Arrays.copyOfRange(parts, 1, parts.length),
                         eof.getValue().getFieldMap());
+
                 } else {
                     result.put( parts[0], field );
                 }
@@ -184,11 +186,15 @@ public class CandidateEntityFilter extends AbstractFilter<FilterResult<Candidate
 
     private boolean nestedFieldCheck( String[] parts, Map<String, Field> fieldMap)
{
         if ( parts.length > 0 ) {
+
             if ( fieldMap.containsKey( parts[0] )) {
                 Field field = fieldMap.get( parts[0] );
                 if ( field instanceof EntityObjectField ) {
                     EntityObjectField eof = (EntityObjectField)field;
+
+                    // recursion
                     return nestedFieldCheck( Arrays.copyOfRange(parts, 1, parts.length),
eof.getValue().getFieldMap());
+
                 } else {
                     return true;
                 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/e9e7c39c/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
index aaf4c33..d62f88e 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
@@ -528,7 +528,7 @@ public class IndexIT extends AbstractCoreIT {
             assertTrue( first.getDynamicProperties().size() == 3 );
         }
 
-        // multiple nested fields with one doubly-nesed field
+        // multiple nested fields with one doubly-nested field
         {
             Query query = Query.fromQL( "select data.rando, data.mondo, data.misc.range where
status = 'pickled'" );
             Results r = em.searchCollection( em.getApplicationRef(), "names", query );


Mime
View raw message