geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zho...@apache.org
Subject incubator-geode git commit: GEODE-11: let profile's getId() return unique name
Date Fri, 02 Sep 2016 01:05:24 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop f497c596c -> 426f1ae22


GEODE-11: let profile's getId() return unique name


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

Branch: refs/heads/develop
Commit: 426f1ae22f1c5933dd14c08c29c7afbfdef60f4f
Parents: f497c59
Author: zhouxh <gzhou@pivotal.io>
Authored: Thu Sep 1 18:04:14 2016 -0700
Committer: zhouxh <gzhou@pivotal.io>
Committed: Thu Sep 1 18:05:06 2016 -0700

----------------------------------------------------------------------
 .../lucene/internal/LuceneIndexCreationProfile.java     | 12 +++---------
 .../cache/lucene/internal/LuceneServiceImpl.java        |  2 +-
 .../internal/LuceneIndexCreationProfileJUnitTest.java   | 12 ++++++------
 3 files changed, 10 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/426f1ae2/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java
b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java
index 720d20d..de331ea 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfile.java
@@ -44,14 +44,6 @@ public class LuceneIndexCreationProfile implements CacheServiceProfile,
DataSeri
   /* Used by DataSerializer */
   public LuceneIndexCreationProfile() {}
 
-  public LuceneIndexCreationProfile(String indexName, String[] fieldNames, Analyzer analyzer,
-      Map<String, Analyzer> fieldAnalyzers) {
-    this.indexName = indexName;
-    this.fieldNames = fieldNames;
-    this.analyzerClass = analyzer.getClass().getSimpleName();
-    initializeFieldAnalyzers(fieldAnalyzers);
-  }
-
   public LuceneIndexCreationProfile(String indexName, String regionPath, String[] fieldNames,
Analyzer analyzer,
                                     Map<String, Analyzer> fieldAnalyzers) {
     this.indexName = indexName;
@@ -90,7 +82,7 @@ public class LuceneIndexCreationProfile implements CacheServiceProfile,
DataSeri
 
   @Override
   public String getId() {
-    return this.indexName;
+    return "lucene_"+LuceneServiceImpl.getUniqueIndexName(indexName, regionPath);
   }
 
   @Override
@@ -143,6 +135,7 @@ public class LuceneIndexCreationProfile implements CacheServiceProfile,
DataSeri
   @Override
   public void toData(DataOutput out) throws IOException {
     DataSerializer.writeString(this.indexName, out);
+    DataSerializer.writeString(this.regionPath, out);
     DataSerializer.writeStringArray(this.fieldNames, out);
     DataSerializer.writeString(this.analyzerClass, out);
     DataSerializer.writeHashMap(this.fieldAnalyzers, out);
@@ -151,6 +144,7 @@ public class LuceneIndexCreationProfile implements CacheServiceProfile,
DataSeri
   @Override
   public void fromData(DataInput in) throws IOException, ClassNotFoundException {
     this.indexName = DataSerializer.readString(in);
+    this.regionPath = DataSerializer.readString(in);
     this.fieldNames = DataSerializer.readStringArray(in);
     this.analyzerClass = DataSerializer.readString(in);
     this.fieldAnalyzers = DataSerializer.readHashMap(in);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/426f1ae2/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
index 29a8e62..81a62b8 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneServiceImpl.java
@@ -183,7 +183,7 @@ public class LuceneServiceImpl implements InternalLuceneService {
           }
 
           // Add index creation profile
-          internalRegionArgs.addCacheServiceProfile(new LuceneIndexCreationProfile(indexName,
fields, analyzer, fieldAnalyzers));
+          internalRegionArgs.addCacheServiceProfile(new LuceneIndexCreationProfile(indexName,
dataRegionPath, fields, analyzer, fieldAnalyzers));
         }
         return updatedRA;
       }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/426f1ae2/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
index c64dd3d..7fbe806 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/LuceneIndexCreationProfileJUnitTest.java
@@ -105,38 +105,38 @@ public class LuceneIndexCreationProfileJUnitTest {
   }
 
   private LuceneIndexCreationProfile getOneFieldLuceneIndexCreationProfile() {
-    return new LuceneIndexCreationProfile(INDEX_NAME, new String[] { "field1" }, new StandardAnalyzer(),
null);
+    return new LuceneIndexCreationProfile(INDEX_NAME, REGION_NAME, new String[] { "field1"
}, new StandardAnalyzer(), null);
   }
 
   private LuceneIndexCreationProfile getTwoFieldLuceneIndexCreationProfile() {
-    return new LuceneIndexCreationProfile(INDEX_NAME, new String[] { "field1", "field2" },
new StandardAnalyzer(), null);
+    return new LuceneIndexCreationProfile(INDEX_NAME, REGION_NAME, new String[] { "field1",
"field2" }, new StandardAnalyzer(), null);
   }
 
   private LuceneIndexCreationProfile getOneAnalyzerLuceneIndexCreationProfile(Analyzer analyzer)
{
     Map<String, Analyzer> fieldAnalyzers = new HashMap<>();
     fieldAnalyzers.put("field1", analyzer);
-    return new LuceneIndexCreationProfile(INDEX_NAME, new String[] { "field1", "field2" },
getPerFieldAnalyzerWrapper(fieldAnalyzers), fieldAnalyzers);
+    return new LuceneIndexCreationProfile(INDEX_NAME, REGION_NAME, new String[] { "field1",
"field2" }, getPerFieldAnalyzerWrapper(fieldAnalyzers), fieldAnalyzers);
   }
 
   private LuceneIndexCreationProfile getTwoAnalyzersLuceneIndexCreationProfile() {
     Map<String, Analyzer> fieldAnalyzers = new HashMap<>();
     fieldAnalyzers.put("field1", new KeywordAnalyzer());
     fieldAnalyzers.put("field2", new KeywordAnalyzer());
-    return new LuceneIndexCreationProfile(INDEX_NAME, new String[] { "field1", "field2" },
getPerFieldAnalyzerWrapper(fieldAnalyzers), fieldAnalyzers);
+    return new LuceneIndexCreationProfile(INDEX_NAME, REGION_NAME, new String[] { "field1",
"field2" }, getPerFieldAnalyzerWrapper(fieldAnalyzers), fieldAnalyzers);
   }
 
   private LuceneIndexCreationProfile getNullField1AnalyzerLuceneIndexCreationProfile() {
     Map<String, Analyzer> fieldAnalyzers = new HashMap<>();
     fieldAnalyzers.put("field1", null);
     fieldAnalyzers.put("field2", new KeywordAnalyzer());
-    return new LuceneIndexCreationProfile(INDEX_NAME, new String[] { "field1", "field2" },
getPerFieldAnalyzerWrapper(fieldAnalyzers), fieldAnalyzers);
+    return new LuceneIndexCreationProfile(INDEX_NAME, REGION_NAME, new String[] { "field1",
"field2" }, getPerFieldAnalyzerWrapper(fieldAnalyzers), fieldAnalyzers);
   }
 
   private LuceneIndexCreationProfile getNullField2AnalyzerLuceneIndexCreationProfile() {
     Map<String, Analyzer> fieldAnalyzers = new HashMap<>();
     fieldAnalyzers.put("field1", new KeywordAnalyzer());
     fieldAnalyzers.put("field2", null);
-    return new LuceneIndexCreationProfile(INDEX_NAME, new String[] { "field1", "field2" },
getPerFieldAnalyzerWrapper(fieldAnalyzers), fieldAnalyzers);
+    return new LuceneIndexCreationProfile(INDEX_NAME, REGION_NAME, new String[] { "field1",
"field2" }, getPerFieldAnalyzerWrapper(fieldAnalyzers), fieldAnalyzers);
   }
 
   private Analyzer getPerFieldAnalyzerWrapper(Map<String, Analyzer> fieldAnalyzers)
{


Mime
View raw message