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 2016/04/19 18:50:59 UTC

[02/50] usergrid git commit: Fix issue with addSort being appended to delete queries many times when there are multiple versions of an entity.

Fix issue with addSort being appended to delete queries many times when there are multiple versions of an entity.


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

Branch: refs/heads/master
Commit: d3df23930218703cda5ea9e7fea86a52ba7efb4a
Parents: a6cfda8
Author: Michael Russo <mr...@apigee.com>
Authored: Tue Apr 5 13:45:42 2016 -0700
Committer: Michael Russo <mr...@apigee.com>
Committed: Tue Apr 5 13:45:42 2016 -0700

----------------------------------------------------------------------
 .../usergrid/persistence/index/impl/EsEntityIndexImpl.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/d3df2393/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 111e16b..98c0738 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
@@ -471,7 +471,9 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
         final QueryBuilder entityQuery = QueryBuilders
             .termQuery(IndexingUtils.EDGE_NODE_ID_FIELDNAME, IndexingUtils.nodeId(edge.getNodeId()));
 
-        final SearchRequestBuilder srb = searchRequestBuilderStrategyV2.getBuilder();
+        final SearchRequestBuilder srb = searchRequestBuilderStrategyV2.getBuilder()
+            .addSort(IndexingUtils.EDGE_TIMESTAMP_FIELDNAME, SortOrder.ASC);
+
 
         if ( logger.isDebugEnabled() ) {
             logger.debug( "Searching for edges in (read alias): {}\n  nodeId: {},\n   query: {} ",
@@ -496,7 +498,6 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
                 searchResponse = srb
                     .setQuery(finalQuery)
                     .setSize(searchLimit)
-                    .addSort(IndexingUtils.EDGE_TIMESTAMP_FIELDNAME, SortOrder.ASC)
                     .execute()
                     .actionGet();
 
@@ -553,7 +554,8 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
         final QueryBuilder nodeQuery = QueryBuilders
             .termQuery(IndexingUtils.EDGE_NODE_ID_FIELDNAME, IndexingUtils.nodeId(entityId));
 
-        final SearchRequestBuilder srb = searchRequestBuilderStrategyV2.getBuilder();
+        final SearchRequestBuilder srb = searchRequestBuilderStrategyV2.getBuilder()
+            .addSort(IndexingUtils.EDGE_TIMESTAMP_FIELDNAME, SortOrder.ASC);
 
         try {
 
@@ -580,7 +582,6 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
                 searchResponse = srb
                     .setQuery(finalQuery)
                     .setSize(searchLimit)
-                    .addSort(IndexingUtils.EDGE_TIMESTAMP_FIELDNAME, SortOrder.ASC)
                     .execute()
                     .actionGet();