Do not add "none" to list of required fields!

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

Branch: refs/heads/asf-site
Commit: d8371e1a64d7f8004233f171eb9ddb79b7166f70
Parents: f505e59
Author: Dave Johnson <snoopd...@apache.org>
Authored: Mon Apr 18 08:26:37 2016 -0400
Committer: Dave Johnson <snoopd...@apache.org>
Committed: Mon Apr 18 08:26:37 2016 -0400

----------------------------------------------------------------------
 .../usergrid/corepersistence/index/IndexServiceImpl.java |  3 +++
 .../java/org/apache/usergrid/rest/NotificationsIT.java   | 11 +++++++++++
 2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/d8371e1a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
index ad997c8..9509626 100644
--- 
a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
+++ 
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
@@ -226,6 +226,9 @@ public class IndexServiceImpl implements IndexService {
                 return Optional.absent();
             }
 
+            // never add "none" because it has special meaning, "none" 
disables indexing for a type
+            fieldsToKeep.remove("none");
+
             defaultProperties.addAll( fieldsToKeep );
         }
         else {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/d8371e1a/stack/rest/src/test/java/org/apache/usergrid/rest/NotificationsIT.java
----------------------------------------------------------------------
diff --git 
a/stack/rest/src/test/java/org/apache/usergrid/rest/NotificationsIT.java 
b/stack/rest/src/test/java/org/apache/usergrid/rest/NotificationsIT.java
index 61dc419..1655846 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/NotificationsIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/NotificationsIT.java
@@ -78,6 +78,17 @@ public class NotificationsIT extends 
org.apache.usergrid.rest.test.resource.Abst
 
     @Test
     public void testPaging() throws Exception {
+
+        // this test should work even with indexing turned off for 
notificaitons collection
+        ArrayList<String> indexingArray = new ArrayList<>(  );
+        indexingArray.add( "none" );
+        Entity payload = new Entity();
+        payload.put( "fields", indexingArray);
+
+        String unIndexedCollectionName = "notifications";
+        app().collection( unIndexedCollectionName ).collection( "_indexes" 
).post( payload );
+        refreshIndex();
+
         // create notifier
         Entity notifier = new Entity().chainPut("name", 
"mynotifier").chainPut("provider", "noop");
 

Reply via email to