You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by zh...@apache.org on 2017/10/17 17:20:41 UTC

[geode] 02/02: GEODE-3727: fix typo and spotlessApply

This is an automated email from the ASF dual-hosted git repository.

zhouxj pushed a commit to branch feature/GEODE-3727
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 7b676af555d003cb32d951ae0493adbbfa8d2456
Author: zhouxh <gz...@pivotal.io>
AuthorDate: Mon Oct 16 17:57:06 2017 -0700

    GEODE-3727: fix typo and spotlessApply
---
 .../geode/cache/lucene/FlatFormatSerializer.java   | 14 ++---
 .../NestedObjectSeralizerIntegrationTest.java      | 59 +++++++++++-----------
 2 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/FlatFormatSerializer.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/FlatFormatSerializer.java
index ec90704..a4b94a2 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/FlatFormatSerializer.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/FlatFormatSerializer.java
@@ -30,7 +30,7 @@ import org.apache.lucene.document.Document;
 /**
  * A built-in {@link LuceneSerializer} to parse user's nested object into a flat format, i.e. a
  * single document. Each nested object will become a set of fields, with field name in format of
- * contact.name, contact.homepage.title.
+ * contacts.name, contacts.homepage.title.
  * 
  * Here is a example of usage:
  * 
@@ -38,16 +38,18 @@ import org.apache.lucene.document.Document;
  * objects' indexed fields in following format:
  * 
  * luceneService.createIndexFactory().setLuceneSerializer(new FlatFormatSerializer())
- * .addField("name").addField("contact.name").addField("contact.email", new KeywordAnalyzer())
- * .addField("contact.address").addField("contact.homepage.content") .create(INDEX_NAME,
+ * .addField("name").addField("contacts.name").addField("contacts.email", new KeywordAnalyzer())
+ * .addField("contacts.address").addField("contacts.homepage.content") .create(INDEX_NAME,
  * REGION_NAME);
  * 
  * Region region = createRegion(REGION_NAME, RegionShortcut.PARTITION);
  * 
- * When querying, use the same dot-separated index field name, such as contact.homepage.content
+ * When querying, use the same dot-separated index field name, such as contacts.homepage.content
  * 
  * LuceneQuery query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME,
- * "contact.homepage.content:Hello*", "name"); results = query.findPages();
+ * "contacts.homepage.content:Hello*", "name");
+ * 
+ * results = query.findPages();
  */
 public class FlatFormatSerializer implements LuceneSerializer {
 
@@ -57,7 +59,7 @@ public class FlatFormatSerializer implements LuceneSerializer {
 
   /**
    * Recursively serialize each indexed field's value into a field of lucene document. The field
-   * name will be in the same format as its indexed, such as contact.homepage.content
+   * name will be in the same format as its indexed, such as contacts.homepage.content
    * 
    * @param index lucene index
    * @param value user object to be serialized into index
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/NestedObjectSeralizerIntegrationTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/NestedObjectSeralizerIntegrationTest.java
index 510b354..aefe7de 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/NestedObjectSeralizerIntegrationTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/NestedObjectSeralizerIntegrationTest.java
@@ -57,8 +57,8 @@ public class NestedObjectSeralizerIntegrationTest extends LuceneIntegrationTest
 
   private Region createRegionAndIndexOnInvalidFields() {
     luceneService.createIndexFactory().setLuceneSerializer(new FlatFormatSerializer())
-        .addField("name").addField("contact").addField("contact.page").addField("contact.missing")
-        .addField("missing2").create(INDEX_NAME, REGION_NAME);
+        .addField("name").addField("contacts").addField("contacts.page")
+        .addField("contacts.missing").addField("missing2").create(INDEX_NAME, REGION_NAME);
 
     Region region = createRegion(REGION_NAME, RegionShortcut.PARTITION);
     return region;
@@ -137,19 +137,19 @@ public class NestedObjectSeralizerIntegrationTest extends LuceneIntegrationTest
     printResults(results);
   }
 
-  // @Test
+  @Test
   public void queryOnContactNameWithExactMath() throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndex();
     feedSomeNestedObjects(region);
 
     query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME,
-        "\"Johnni Jackson\"", "contact.name");
+        "\"Johnni Jackson\"", "contacts.name");
     results = query.findPages();
     assertEquals(1, results.size());
     printResults(results);
   }
 
-  // @Test
+  @Test
   public void queryOnNameWithWrongValue() throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndex();
     feedSomeNestedObjects(region);
@@ -160,7 +160,7 @@ public class NestedObjectSeralizerIntegrationTest extends LuceneIntegrationTest
     assertEquals(0, results.size());
   }
 
-  // @Test
+  @Test
   public void queryOnNameWithExactMatch() throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndex();
     feedSomeNestedObjects(region);
@@ -172,20 +172,19 @@ public class NestedObjectSeralizerIntegrationTest extends LuceneIntegrationTest
     printResults(results);
   }
 
-  // @Test
+  @Test
   public void queryOnContactEmailWithAnalyzer() throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndex();
     feedSomeNestedObjects(region);
 
-    // query-3: contact.email with KeywordAnalyzer
     query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME,
-        "Johnni.Jackson2@pivotal.io", "contact.email");
+        "Johnni.Jackson2@pivotal.io", "contacts.email");
     results = query.findPages();
     assertEquals(1, results.size());
     printResults(results);
   }
 
-  // @Test
+  @Test
   public void queryOnNonExistEmailField() throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndex();
     feedSomeNestedObjects(region);
@@ -196,20 +195,20 @@ public class NestedObjectSeralizerIntegrationTest extends LuceneIntegrationTest
     assertEquals(0, results.size());
   }
 
-  // @Test
+  @Test
   public void queryOnContactAddressWithStandardAnalyzer()
       throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndex();
     feedSomeNestedObjects(region);
 
     query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME, "97006",
-        "contact.address");
+        "contacts.address");
     results = query.findPages();
     assertEquals(4, results.size());
     printResults(results);
   }
 
-  // @Test
+  @Test
   public void queryOnNonExistAddressField() throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndex();
     feedSomeNestedObjects(region);
@@ -220,19 +219,19 @@ public class NestedObjectSeralizerIntegrationTest extends LuceneIntegrationTest
     assertEquals(0, results.size());
   }
 
-  // @Test
+  @Test
   public void queryOnThreeLayerField() throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndex();
     feedSomeNestedObjects(region);
 
     query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME,
-        "contact.homepage.content:Hello", "name");
+        "contacts.homepage.content:Hello", "name");
     results = query.findPages();
     printResults(results);
     assertEquals(4, results.size());
   }
 
-  // @Test
+  @Test
   public void queryOnThirdLayerFieldDirectlyShouldNotGetResult()
       throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndex();
@@ -244,7 +243,7 @@ public class NestedObjectSeralizerIntegrationTest extends LuceneIntegrationTest
     printResults(results);
   }
 
-  // @Test
+  @Test
   public void queryOnRegionValueField() throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndex();
     feedSomeNestedObjects(region);
@@ -256,7 +255,7 @@ public class NestedObjectSeralizerIntegrationTest extends LuceneIntegrationTest
     assertEquals(4, results.size());
   }
 
-  // @Test
+  @Test
   public void nonExistFieldsShouldBeIgnored() throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndexOnInvalidFields();
     feedSomeNestedObjects(region);
@@ -268,19 +267,19 @@ public class NestedObjectSeralizerIntegrationTest extends LuceneIntegrationTest
     printResults(results);
   }
 
-  // @Test
+  @Test
   public void queryOnNotIndexedFieldShouldReturnNothing()
       throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndexOnInvalidFields();
     feedSomeNestedObjects(region);
 
     query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME,
-        "\"Johnni Jackson\"", "contact.name");
+        "\"Johnni Jackson\"", "contacts.name");
     results = query.findPages();
     assertEquals(0, results.size());
   }
 
-  // @Test
+  @Test
   public void queryWithExactMatchWhileIndexOnSomeWrongFields()
       throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndexOnInvalidFields();
@@ -293,55 +292,55 @@ public class NestedObjectSeralizerIntegrationTest extends LuceneIntegrationTest
     printResults(results);
   }
 
-  // @Test
+  @Test
   public void queryOnNotIndexedFieldWithAnalyzerShouldReturnNothing()
       throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndexOnInvalidFields();
     feedSomeNestedObjects(region);
 
     query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME,
-        "Johnni.Jackson2@pivotal.io", "contact.email");
+        "Johnni.Jackson2@pivotal.io", "contacts.email");
     results = query.findPages();
     assertEquals(0, results.size());
   }
 
-  // @Test
+  @Test
   public void queryOnNotIndexedContactAddressFieldShouldReturnNothing()
       throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndexOnInvalidFields();
     feedSomeNestedObjects(region);
 
     query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME, "97006",
-        "contact.address");
+        "contacts.address");
     results = query.findPages();
     assertEquals(0, results.size());
   }
 
-  // @Test
+  @Test
   public void queryOnNotIndexedThreeLayerFieldShouldReturnNothing()
       throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndexOnInvalidFields();
     feedSomeNestedObjects(region);
 
     query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME,
-        "contact.homepage.content:Hello", "name");
+        "contacts.homepage.content:Hello", "name");
     results = query.findPages();
     assertEquals(0, results.size());
   }
 
-  // @Test
+  @Test
   public void queryOnNotExistSecondLevelFieldShouldReturnNothing()
       throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndexOnInvalidFields();
     feedSomeNestedObjects(region);
 
     query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME, "*",
-        "contact.missing");
+        "contacts.missing");
     results = query.findPages();
     assertEquals(0, results.size());
   }
 
-  // @Test
+  @Test
   public void queryOnNotExistTopLevelFieldShouldReturnNothing()
       throws InterruptedException, LuceneQueryException {
     Region region = createRegionAndIndexOnInvalidFields();

-- 
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <co...@geode.apache.org>.