geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject incubator-geode git commit: Making the analyzer configurable for PartitionedRepositoryManager
Date Tue, 22 Sep 2015 18:57:52 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-11 6bb17b531 -> 18e8f4165


Making the analyzer configurable for PartitionedRepositoryManager

This class should accept an analyzer to be used to create the index
writer.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/18e8f416
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/18e8f416
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/18e8f416

Branch: refs/heads/feature/GEODE-11
Commit: 18e8f416547ff82ae7a1d7997be3996372a44ddd
Parents: 6bb17b5
Author: Dan Smith <upthewaterspout@apache.org>
Authored: Tue Sep 22 11:08:02 2015 -0700
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Tue Sep 22 11:08:02 2015 -0700

----------------------------------------------------------------------
 .../cache/lucene/internal/PartitionedRepositoryManager.java | 8 ++++----
 .../internal/PartitionedRepositoryManagerJUnitTest.java     | 9 +++++----
 2 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/18e8f416/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
----------------------------------------------------------------------
diff --git a/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
b/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
index ba89a40..e301482 100644
--- a/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
+++ b/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManager.java
@@ -6,7 +6,6 @@ import java.util.Collection;
 import java.util.Set;
 
 import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
 
@@ -46,8 +45,8 @@ public class PartitionedRepositoryManager implements RepositoryManager {
   
   private final PartitionedRegion fileRegion;
   private final PartitionedRegion chunkRegion;
-
   private final LuceneSerializer serializer;
+  private final Analyzer analyzer;
   
   /**
    * 
@@ -58,11 +57,13 @@ public class PartitionedRepositoryManager implements RepositoryManager
{
    */
   public PartitionedRepositoryManager(PartitionedRegion userRegion, PartitionedRegion fileRegion,
       PartitionedRegion chunkRegion,
-      LuceneSerializer serializer) {
+      LuceneSerializer serializer,
+      Analyzer analyzer) {
     this.userRegion = userRegion;
     this.fileRegion = fileRegion;
     this.chunkRegion = chunkRegion;
     this.serializer = serializer;
+    this.analyzer = analyzer;
   }
 
   @Override
@@ -103,7 +104,6 @@ public class PartitionedRepositoryManager implements RepositoryManager
{
     IndexRepository repo = indexRepositories.get(userBucket);
     if(repo == null) {
       try {
-        Analyzer analyzer = new StandardAnalyzer();
         RegionDirectory dir = new RegionDirectory(getMatchingBucket(userBucket, fileRegion),
getMatchingBucket(userBucket, chunkRegion));
         IndexWriterConfig config = new IndexWriterConfig(analyzer);
         IndexWriter writer = new IndexWriter(dir, config);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/18e8f416/gemfire-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
b/gemfire-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
index c7a2362..db1085a 100644
--- a/gemfire-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
+++ b/gemfire-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PartitionedRepositoryManagerJUnitTest.java
@@ -12,6 +12,7 @@ import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.index.IndexWriter;
 import org.junit.Before;
 import org.junit.Test;
@@ -62,7 +63,7 @@ public class PartitionedRepositoryManagerJUnitTest {
   
   @Test
   public void getByKey() throws BucketNotFoundException, IOException {
-    PartitionedRepositoryManager repoManager = new PartitionedRepositoryManager(userRegion,
fileRegion, chunkRegion, serializer);
+    PartitionedRepositoryManager repoManager = new PartitionedRepositoryManager(userRegion,
fileRegion, chunkRegion, serializer, new StandardAnalyzer());
     
     BucketRegion mockBucket0 = getMockBucket(0);
     BucketRegion mockBucket1 = getMockBucket(1);
@@ -86,14 +87,14 @@ public class PartitionedRepositoryManagerJUnitTest {
    */
   @Test(expected = BucketNotFoundException.class)
   public void getMissingBucketByKey() throws BucketNotFoundException {
-    PartitionedRepositoryManager repoManager = new PartitionedRepositoryManager(userRegion,
fileRegion, chunkRegion, serializer);
+    PartitionedRepositoryManager repoManager = new PartitionedRepositoryManager(userRegion,
fileRegion, chunkRegion, serializer, new StandardAnalyzer());
     repoManager.getRepository(userRegion, 0, null);
   }
   
   @Test
   public void getByRegion() throws BucketNotFoundException {
 
-    PartitionedRepositoryManager repoManager = new PartitionedRepositoryManager(userRegion,
fileRegion, chunkRegion, serializer);
+    PartitionedRepositoryManager repoManager = new PartitionedRepositoryManager(userRegion,
fileRegion, chunkRegion, serializer, new StandardAnalyzer());
     
     BucketRegion mockBucket0 = getMockBucket(0);
     BucketRegion mockBucket1 = getMockBucket(1);
@@ -120,7 +121,7 @@ public class PartitionedRepositoryManagerJUnitTest {
    */
   @Test(expected = BucketNotFoundException.class)
   public void getMissingBucketByRegion() throws BucketNotFoundException {
-    PartitionedRepositoryManager repoManager = new PartitionedRepositoryManager(userRegion,
fileRegion, chunkRegion, serializer);
+    PartitionedRepositoryManager repoManager = new PartitionedRepositoryManager(userRegion,
fileRegion, chunkRegion, serializer, new StandardAnalyzer());
     
     BucketRegion mockBucket0 = getMockBucket(0);
 


Mime
View raw message