You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2017/05/31 17:01:26 UTC
[21/32] geode git commit: GEODE-2960 : Trim field parameter values
from create lucene index.
GEODE-2960 : Trim field parameter values from create lucene index.
* Added logic to trim leading and trailing spaces from values provided against 'field'.
* Modified existing test case to verify changes.
This closes #541
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/d50489c6
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/d50489c6
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/d50489c6
Branch: refs/heads/feature/GEODE-1279
Commit: d50489c6c526ab996c4ff8883283a6e8f7a228a1
Parents: d3543d2
Author: Deepak Dixit <de...@gmail.com>
Authored: Fri May 26 16:59:41 2017 +0530
Committer: nabarun <nn...@pivotal.io>
Committed: Tue May 30 11:59:34 2017 -0700
----------------------------------------------------------------------
.../geode/cache/lucene/internal/cli/LuceneIndexCommands.java | 7 ++++++-
.../configuration/LuceneClusterConfigurationDUnitTest.java | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/d50489c6/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
index 9317e2e..2fa9356 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
@@ -53,6 +53,7 @@ import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.core.annotation.CliOption;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
@@ -184,7 +185,11 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
this.securityService.authorizeRegionManage(regionPath);
try {
final InternalCache cache = getCache();
- LuceneIndexInfo indexInfo = new LuceneIndexInfo(indexName, regionPath, fields, analyzers);
+ // trim fields for any leading trailing spaces.
+ String[] trimmedFields =
+ Arrays.stream(fields).map(field -> field.trim()).toArray(size -> new String[size]);
+ LuceneIndexInfo indexInfo =
+ new LuceneIndexInfo(indexName, regionPath, trimmedFields, analyzers);
final ResultCollector<?, ?> rc =
this.executeFunctionOnAllMembers(createIndexFunction, indexInfo);
final List<CliFunctionResult> funcResults = (List<CliFunctionResult>) rc.getResult();
http://git-wip-us.apache.org/repos/asf/geode/blob/d50489c6/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java
index 7acff1b..867dc2e 100755
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java
@@ -259,7 +259,7 @@ public class LuceneClusterConfigurationDUnitTest {
CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_CREATE_INDEX);
csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME, indexName);
csb.addOption(LuceneCliStrings.LUCENE__REGION_PATH, REGION_NAME);
- csb.addOption(LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD, "field1,field2,field3");
+ csb.addOption(LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD, "'field1, field2, field3'");
gfshConnector.executeAndVerifyCommand(csb.toString());
}