usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject usergrid git commit: Fix getAllEdgeDocuments in deleteEdge to return docs where entityId matches and not just the nodeId. Also fix test that wasn't actually testing this.
Date Wed, 13 Jul 2016 00:12:48 GMT
Repository: usergrid
Updated Branches:
  refs/heads/release-2.1.1 8faad5bdc -> a8f4218a7


Fix getAllEdgeDocuments in deleteEdge to return docs where entityId matches and not just the
nodeId.  Also fix test that wasn't actually testing this.


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

Branch: refs/heads/release-2.1.1
Commit: a8f4218a7907db16297bd34cc859441b99a9c35c
Parents: 8faad5b
Author: Michael Russo <mrusso@apigee.com>
Authored: Tue Jul 12 17:09:43 2016 -0700
Committer: Michael Russo <mrusso@apigee.com>
Committed: Tue Jul 12 17:09:43 2016 -0700

----------------------------------------------------------------------
 .../corepersistence/index/IndexServiceTest.java       | 14 ++++++++++++--
 .../persistence/index/impl/EsEntityIndexImpl.java     |  8 ++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/a8f4218a/stack/core/src/test/java/org/apache/usergrid/corepersistence/index/IndexServiceTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/index/IndexServiceTest.java
b/stack/core/src/test/java/org/apache/usergrid/corepersistence/index/IndexServiceTest.java
index fba6e7c..adecd9d 100644
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/index/IndexServiceTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/index/IndexServiceTest.java
@@ -355,6 +355,12 @@ public class IndexServiceTest {
 
         final SearchEdge connectionSearchEdge = CpNamingUtils.createSearchEdgeFromSource(
connectionSearch );
 
+        //ensure that no edges remain
+        CandidateResults connectionResultsEmpty = EntityIndex.search( connectionSearchEdge,
+            SearchTypes.fromTypes( "thing" ),"select *",10,0 );
+
+        assertEquals(1,connectionResultsEmpty.size());
+
         //step 1
         //(We need to mark then delete things in the graph manager.)
         final Edge toBeMarkedEdge = graphManager.markEdge( connectionSearch ).toBlocking().firstOrDefault(
null );
@@ -367,9 +373,13 @@ public class IndexServiceTest {
 
         assertEquals( 1, indexOperationMessage.getDeIndexRequests().size() );
 
+        indexProducer.put(indexOperationMessage).toBlocking().last();
+
+        Thread.sleep(1000); // wait for the operation to flush at Elasticsearch
+
         //ensure that no edges remain
-        final CandidateResults connectionResultsEmpty = EntityIndex.search( connectionSearchEdge,
-            SearchTypes.fromTypes( "things" ),"select *",10,0 );
+        connectionResultsEmpty = EntityIndex.search( connectionSearchEdge,
+            SearchTypes.fromTypes( "thing" ),"select *",10,0 );
 
         assertEquals(0,connectionResultsEmpty.size());
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/a8f4218a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git 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
index dc110f7..d2aff7e 100644
--- 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
@@ -469,9 +469,12 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
         // never let this fetch more than 100 to save memory
         final int searchLimit = Math.min(100, indexFig.getVersionQueryLimit());
 
-        final QueryBuilder entityQuery = QueryBuilders
+        final QueryBuilder nodeIdQuery = QueryBuilders
             .termQuery(IndexingUtils.EDGE_NODE_ID_FIELDNAME, IndexingUtils.nodeId(edge.getNodeId()));
 
+        final QueryBuilder entityIdQuery = QueryBuilders
+            .termQuery(IndexingUtils.ENTITY_ID_FIELDNAME, IndexingUtils.entityId(entityId));
+
         final SearchRequestBuilder srb = searchRequestBuilderStrategyV2.getBuilder()
             .addSort(IndexingUtils.EDGE_TIMESTAMP_FIELDNAME, SortOrder.ASC);
 
@@ -492,7 +495,8 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
 
             QueryBuilder finalQuery = QueryBuilders
                 .boolQuery()
-                .must(entityQuery)
+                .must(entityIdQuery)
+                .must(nodeIdQuery)
                 .must(timestampQuery);
 
             searchResponse = srb


Mime
View raw message