geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zho...@apache.org
Subject [geode] branch develop updated: GEODE-3568: User can set a LuceneSerializer through the Java API
Date Thu, 07 Sep 2017 00:24:31 GMT
This is an automated email from the ASF dual-hosted git repository.

zhouxj pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 51b13ab  GEODE-3568: User can set a LuceneSerializer through the Java API
51b13ab is described below

commit 51b13ab96d95af6d72ea2921ce575e8f4ecc97d7
Author: zhouxh <gzhou@pivotal.io>
AuthorDate: Wed Sep 6 16:43:24 2017 -0700

    GEODE-3568: User can set a LuceneSerializer through the Java API
    
    This closes #760
---
 .../java/org/apache/geode/cache/lucene/LuceneIndexFactory.java   | 9 +++++++++
 .../geode/cache/lucene/internal/LuceneIndexFactoryImpl.java      | 6 ++++++
 .../repository/serializer/HeterogeneousLuceneSerializer.java     | 5 +++++
 .../lucene/internal/repository/serializer/LuceneSerializer.java  | 6 ++++++
 .../internal/repository/serializer/PdxLuceneSerializer.java      | 7 +++++++
 .../internal/repository/serializer/PrimitiveSerializer.java      | 7 +++++++
 .../repository/serializer/ReflectionLuceneSerializer.java        | 6 ++++++
 7 files changed, 46 insertions(+)

diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndexFactory.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndexFactory.java
index a737cbe..f01ef1b 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndexFactory.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneIndexFactory.java
@@ -14,6 +14,7 @@
  */
 package org.apache.geode.cache.lucene;
 
+import org.apache.geode.cache.lucene.internal.repository.serializer.LuceneSerializer;
 import org.apache.lucene.analysis.Analyzer;
 
 import java.util.Map;
@@ -81,4 +82,12 @@ public interface LuceneIndexFactory {
    */
   void create(String indexName, String regionPath);
 
+  /**
+   * Configure the way objects are converted to lucene documents for this lucene index
+   * 
+   * @param luceneSerializer A callback which converts a region value to a lucene document
or
+   *        documents to be stored in the index.
+   */
+  public LuceneIndexFactory setLuceneSerializer(LuceneSerializer luceneSerializer);
+
 }
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactoryImpl.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactoryImpl.java
index b77d8b6..8ffe38c 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactoryImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexFactoryImpl.java
@@ -15,6 +15,7 @@
 package org.apache.geode.cache.lucene.internal;
 
 import org.apache.geode.cache.lucene.LuceneIndexFactory;
+import org.apache.geode.cache.lucene.internal.repository.serializer.LuceneSerializer;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 
@@ -62,4 +63,9 @@ public class LuceneIndexFactoryImpl implements org.apache.geode.cache.lucene.Luc
     service.createIndex(indexName, regionPath, fields);
 
   }
+
+  @Override
+  public LuceneIndexFactory setLuceneSerializer(LuceneSerializer luceneSerializer) {
+    return this;
+  }
 }
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/HeterogeneousLuceneSerializer.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/HeterogeneousLuceneSerializer.java
index 3c2f8b7..09d3832 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/HeterogeneousLuceneSerializer.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/HeterogeneousLuceneSerializer.java
@@ -15,6 +15,7 @@
 package org.apache.geode.cache.lucene.internal.repository.serializer;
 
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Map;
 
 import org.apache.logging.log4j.Logger;
@@ -102,5 +103,9 @@ public class HeterogeneousLuceneSerializer implements LuceneSerializer
{
     }
   }
 
+  @Override
+  public Collection<Document> toDocuments(Object value) {
+    return null;
+  }
 
 }
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/LuceneSerializer.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/LuceneSerializer.java
index fa38f47..8b9b664 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/LuceneSerializer.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/LuceneSerializer.java
@@ -15,6 +15,8 @@
 
 package org.apache.geode.cache.lucene.internal.repository.serializer;
 
+import java.util.Collection;
+
 import org.apache.lucene.document.Document;
 
 /**
@@ -27,4 +29,8 @@ public interface LuceneSerializer {
    */
   void toDocument(Object value, Document doc);
 
+  /**
+   * Add the fields of the given value to a set of documents
+   */
+  Collection<Document> toDocuments(Object value);
 }
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PdxLuceneSerializer.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PdxLuceneSerializer.java
index f34390c..c9aaed2 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PdxLuceneSerializer.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PdxLuceneSerializer.java
@@ -18,6 +18,8 @@ package org.apache.geode.cache.lucene.internal.repository.serializer;
 import org.apache.logging.log4j.Logger;
 import org.apache.lucene.document.Document;
 
+import java.util.Collection;
+
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.pdx.PdxInstance;
 
@@ -50,4 +52,9 @@ class PdxLuceneSerializer implements LuceneSerializer {
       logger.debug("PdxLuceneSerializer.toDocument:" + doc);
     }
   }
+
+  @Override
+  public Collection<Document> toDocuments(Object value) {
+    return null;
+  }
 }
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PrimitiveSerializer.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PrimitiveSerializer.java
index cf644a8..5e30a43 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PrimitiveSerializer.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/PrimitiveSerializer.java
@@ -14,6 +14,8 @@
  */
 package org.apache.geode.cache.lucene.internal.repository.serializer;
 
+import java.util.Collection;
+
 import org.apache.geode.cache.lucene.LuceneService;
 
 import org.apache.lucene.document.Document;
@@ -28,4 +30,9 @@ public class PrimitiveSerializer implements LuceneSerializer {
   public void toDocument(final Object value, final Document doc) {
     SerializerUtil.addField(doc, LuceneService.REGION_VALUE_FIELD, value);
   }
+
+  @Override
+  public Collection<Document> toDocuments(Object value) {
+    return null;
+  }
 }
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/ReflectionLuceneSerializer.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/ReflectionLuceneSerializer.java
index 07a66fb..05cccc2 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/ReflectionLuceneSerializer.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/serializer/ReflectionLuceneSerializer.java
@@ -18,6 +18,7 @@ package org.apache.geode.cache.lucene.internal.repository.serializer;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -76,4 +77,9 @@ class ReflectionLuceneSerializer implements LuceneSerializer {
       logger.debug("ReflectionLuceneSerializer.toDocument:" + doc);
     }
   }
+
+  @Override
+  public Collection<Document> toDocuments(Object value) {
+    return null;
+  }
 }

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

Mime
View raw message