You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2017/02/22 19:49:41 UTC

usergrid git commit: Fix condition with deciding whether or not to use the known field type vs. adding the default sort predicate types.

Repository: usergrid
Updated Branches:
  refs/heads/master 5903c3c14 -> 842684050


Fix condition with deciding whether or not to use the known field type vs. adding the default sort predicate types.


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

Branch: refs/heads/master
Commit: 8426840508a7cd3924bd830f9638e634e76e1aff
Parents: 5903c3c
Author: Michael Russo <ru...@google.com>
Authored: Wed Feb 22 11:49:08 2017 -0800
Committer: Michael Russo <ru...@google.com>
Committed: Wed Feb 22 11:49:08 2017 -0800

----------------------------------------------------------------------
 .../index/impl/SearchRequestBuilderStrategy.java   | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/84268405/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SearchRequestBuilderStrategy.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SearchRequestBuilderStrategy.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SearchRequestBuilderStrategy.java
index c8dd79e..e792495 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SearchRequestBuilderStrategy.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SearchRequestBuilderStrategy.java
@@ -167,17 +167,16 @@ public class SearchRequestBuilderStrategy {
             // fieldsWithType gives the caller an option to provide any schema related details on properties that
             // might appear in a sort predicate.  loop through these and set a specific sort, rather than adding a sort
             // for all possible types
-            else if ( knownFieldsWithType != null && knownFieldsWithType.size() > 0) {
-                if (knownFieldsWithType.containsKey(propertyName)){
+            else if ( knownFieldsWithType != null && knownFieldsWithType.size() > 0 && knownFieldsWithType.containsKey(propertyName)) {
 
-                    String esFieldName = EsQueryVistor.getFieldNameForClass(knownFieldsWithType.get(propertyName));
-                    // always make sure string sorts use the unanalyzed field
-                    if ( esFieldName.equals(IndexingUtils.FIELD_STRING_NESTED)){
-                        esFieldName = IndexingUtils.FIELD_STRING_NESTED_UNANALYZED;
-                    }
-
-                    srb.addSort( createSort( order, esFieldName, propertyName ) );
+                String esFieldName = EsQueryVistor.getFieldNameForClass(knownFieldsWithType.get(propertyName));
+                // always make sure string sorts use the unanalyzed field
+                if ( esFieldName.equals(IndexingUtils.FIELD_STRING_NESTED)){
+                    esFieldName = IndexingUtils.FIELD_STRING_NESTED_UNANALYZED;
                 }
+
+                srb.addSort( createSort( order, esFieldName, propertyName ) );
+
             }
             //apply regular sort logic which check all possible data types, since this is not a known property name
             else {