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/11/24 15:40:52 UTC

[7/9] incubator-usergrid git commit: Merge remote-tracking branch 'origin/two-dot-o' into two-dot-o-events

Merge remote-tracking branch 'origin/two-dot-o' into two-dot-o-events

Conflicts:
	stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
	stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java


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

Branch: refs/heads/two-dot-o-events
Commit: ee260cc158c0df12198a0671d96e07a0089f17ca
Parents: 43105f1 74866a5
Author: Dave Johnson <dm...@apigee.com>
Authored: Mon Nov 24 09:28:17 2014 -0500
Committer: Dave Johnson <dm...@apigee.com>
Committed: Mon Nov 24 09:28:17 2014 -0500

----------------------------------------------------------------------
 .../org/apache/usergrid/persistence/GeoIT.java  | 404 +++++++++++++------
 .../index/impl/EsEntityIndexBatchImpl.java      |  69 ++--
 .../index/impl/EsEntityIndexImpl.java           | 105 +++--
 .../persistence/index/impl/EsProvider.java      |  55 +--
 .../persistence/index/impl/EsQueryVistor.java   |   3 +-
 .../index/impl/FailureMonitorImpl.java          |   4 +-
 .../persistence/index/impl/IndexingUtils.java   |  51 +--
 .../index/query/CandidateResults.java           |   3 -
 .../persistence/index/query/EntityResults.java  |   4 +-
 .../persistence/index/query/Identifier.java     |   3 +-
 .../usergrid/persistence/index/query/Query.java |  26 +-
 .../apache/usergrid/rest/AbstractRestIT.java    |   5 +-
 .../collection/BrowserCompatibilityTest.java    |   2 +-
 .../collection/DuplicateNameIT.java             |   2 +-
 .../collection/activities/PutTest.java          |   2 +-
 .../collection/groups/GroupResourceIT.java      | 240 +++++++++--
 .../collection/paging/PagingEntitiesTest.java   |   4 +-
 .../collection/paging/PagingResourceIT.java     |  14 +-
 .../users/ConnectionResourceTest.java           |  16 +-
 .../collection/users/OwnershipResourceIT.java   |  18 +-
 .../collection/users/RetrieveUsersTest.java     |   4 +-
 .../applications/queries/AndOrQueryTest.java    |  13 +-
 .../queries/BadGrammarQueryTest.java            |   2 +-
 .../applications/queries/GeoPagingTest.java     | 222 +++++++++-
 .../applications/queries/MatrixQueryTests.java  |   2 +-
 .../rest/applications/queries/OrderByTest.java  |   6 +-
 .../usergrid/rest/test/resource/Connection.java |   9 +
 .../rest/test/resource/TestContext.java         |  66 ++-
 .../rest/test/resource/ValueResource.java       |   2 +
 .../rest/test/resource/app/Application.java     |  16 +-
 .../rest/test/resource/app/Collection.java      |  81 ++++
 .../usergrid/rest/test/resource/app/Group.java  |  56 +++
 .../test/resource/app/GroupsCollection.java     |  66 +++
 .../usergrid/rest/test/resource/app/Role.java   |  56 +++
 .../rest/test/resource/app/RolesCollection.java |  64 +++
 .../rest/test/resource/app/UsersCollection.java |  26 +-
 36 files changed, 1336 insertions(+), 385 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ee260cc1/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
index e0ec1ed,4ce4d12..6e68791
--- 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
@@@ -173,9 -179,10 +185,10 @@@ public class EsEntityIndexBatchImpl imp
          }
  
  
 -        log.debug( "De-indexing type {} with documentId '{}'" , entityType, indexId);
 +        log.debug( "De-indexing type {} with documentId '{}'", entityType, indexId );
  
-         bulkRequest.add( client.prepareDelete( indexName, entityType, indexId ).setRefresh( refresh ) );
+         bulkRequest.add( client.prepareDelete( 
+                 indexName, entityType, indexId ).setRefresh( refresh ) );
  
          log.debug( "Deindexed Entity with index id " + indexId );
  

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ee260cc1/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 406c967,22aa05c..53aaf54
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@@ -221,16 -214,16 +222,16 @@@ public class EsEntityIndexImpl implemen
       */
      private void createMappings() throws IOException {
  
-         XContentBuilder xcb =
-                 IndexingUtils.createDoubleStringIndexMapping( XContentFactory.jsonBuilder(), "_default_" );
+         XContentBuilder xcb = IndexingUtils.createDoubleStringIndexMapping( 
+                 XContentFactory.jsonBuilder(), "_default_" );
  
-         PutIndexTemplateResponse pitr =
-                 esProvider.getClient().admin().indices().preparePutTemplate( "usergrid_template" )
-                           .setTemplate( config.getIndexPrefix() + "*" ).addMapping( "_default_",
-                         xcb ) // set mapping as the default for all types
-                         .execute().actionGet();
+         PutIndexTemplateResponse pitr = esProvider.getClient().admin().indices()
+                 .preparePutTemplate( "usergrid_template" )
+                 // set mapping as the default for all types
+                 .setTemplate( config.getIndexPrefix() + "*" ).addMapping( "_default_", xcb ) 
+                 .execute().actionGet();
  
 -        if(!pitr.isAcknowledged()){
 +        if ( !pitr.isAcknowledged() ) {
              throw new IndexException( "Unable to create default mappings" );
          }
      }
@@@ -306,10 -300,10 +308,9 @@@
              }
  
  
 -
              if ( logger.isDebugEnabled() ) {
-                 logger.debug( "Searching index {}\n  scope{} \n type {}\n   query {} ", new Object[] {
-                         this.indexName, context, entityTypes, srb
-                 } );
+                 logger.debug( "Searching index {}\n  scope{} \n type {}\n   query {} ", 
+                         new Object[] { this.indexName, context, entityTypes, srb } );
              }
  
  

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ee260cc1/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexingUtils.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexingUtils.java
index ee5557c,6d34b15..4319ce4
--- 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
@@@ -158,11 -153,11 +155,11 @@@ public class IndexingUtils 
  
                      .startArray( "dynamic_templates" )
  
-                            //we need most specific mappings first since it's a stop on match algorithm
+                         // we need most specific mappings first since it's a stop on match algorithm
  
                          .startObject()
 -                        .startObject( "context_template" )
 -                            .field( "match", IndexingUtils.ENTITYID_ID_FIELDNAME )
 +                        .startObject( "entity_id_template" )
 +                            .field( "match", IndexingUtils.ENTITY_ID_FIELDNAME )
                                   .field( "match_mapping_type", "string" )
                                          .startObject( "mapping" ).field( "type", "string" )
                                               .field( "index", "not_analyzed" )
@@@ -170,47 -165,44 +167,53 @@@
                                   .endObject()
                               .endObject()
  
- 
                          .startObject()
 -                        .startObject( "context_template" )
 +                        .startObject( "entity_context_template" )
                              .field( "match", IndexingUtils.ENTITY_CONTEXT_FIELDNAME )
                              .field( "match_mapping_type", "string" )
-                                 .startObject( "mapping" ).field( "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()
 +
                          // any string with field name that starts with sa_ gets analyzed
                          .startObject()
-                             .startObject( "template_1" ).field( "match", ANALYZED_STRING_PREFIX + "*" )
-                             .field( "match_mapping_type", "string" ).startObject( "mapping" ).field( "type", "string" )
-                             .field( "index", "analyzed" ).endObject().endObject()
+                             .startObject( "template_1" )
+                                 .field( "match", ANALYZED_STRING_PREFIX + "*" )
+                                 .field( "match_mapping_type", "string" ).startObject( "mapping" )
+                                 .field( "type", "string" )
+                                 .field( "index", "analyzed" )
+                             .endObject()
                          .endObject()
+                     .endObject()
  
-                                 // all other strings are not analyzed
-                         .startObject()
-                             .startObject( "template_2" )
-                                     //todo, should be string prefix, remove 2 field mapping
-                                 .field( "match", "*" ).field( "match_mapping_type", "string" ).startObject( "mapping" )
+                     // all other strings are not analyzed
+                     .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()
+                     .endObject()
  
-                         // fields names starting with go_ get geo-indexed
-                         .startObject()
-                             .startObject( "template_3" )
-                                 .field( "match", GEO_PREFIX + "location" )
+                     // fields names starting with go_ get geo-indexed
+                     .startObject()
+                         .startObject( "template_3" )
+                             .field( "match", GEO_PREFIX + "location" )
                                  .startObject( "mapping" )
                                      .field( "type", "geo_point" )
                                  .endObject()