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 18:47:50 UTC
usergrid git commit: Always make sure FIELD_STRING_NESTED_UNANALYZED
is used for known field String values in sort predicates.
Repository: usergrid
Updated Branches:
refs/heads/master 447b5b830 -> 5903c3c14
Always make sure FIELD_STRING_NESTED_UNANALYZED is used for known field String values in sort predicates.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/5903c3c1
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/5903c3c1
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/5903c3c1
Branch: refs/heads/master
Commit: 5903c3c14d9b7bc396a92bb456c73ab22f90f9fb
Parents: 447b5b8
Author: Michael Russo <ru...@google.com>
Authored: Wed Feb 22 10:47:26 2017 -0800
Committer: Michael Russo <ru...@google.com>
Committed: Wed Feb 22 10:47:26 2017 -0800
----------------------------------------------------------------------
.../index/impl/SearchRequestBuilderStrategy.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/5903c3c1/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 c201fb6..c8dd79e 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
@@ -169,7 +169,14 @@ public class SearchRequestBuilderStrategy {
// for all possible types
else if ( knownFieldsWithType != null && knownFieldsWithType.size() > 0) {
if (knownFieldsWithType.containsKey(propertyName)){
- srb.addSort( createSort( order, EsQueryVistor.getFieldNameForClass(knownFieldsWithType.get(propertyName)), 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