浏览代码

fix #1250 append / to dictionaryPath

Shinsuke Sugaya 7 年之前
父节点
当前提交
cc5dc0b7b5
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/main/java/org/codelibs/fess/es/client/FessEsClient.java

+ 4 - 1
src/main/java/org/codelibs/fess/es/client/FessEsClient.java

@@ -396,7 +396,10 @@ public class FessEsClient implements Client {
         final String indexConfigFile = indexConfigPath + "/" + index + ".json";
         final String indexConfigFile = indexConfigPath + "/" + index + ".json";
         try {
         try {
             String source = FileUtil.readUTF8(indexConfigFile);
             String source = FileUtil.readUTF8(indexConfigFile);
-            final String dictionaryPath = System.getProperty("fess.dictionary.path", StringUtil.EMPTY);
+            String dictionaryPath = System.getProperty("fess.dictionary.path", StringUtil.EMPTY);
+            if (StringUtil.isNotBlank(dictionaryPath) && !dictionaryPath.endsWith("/")) {
+                dictionaryPath = dictionaryPath + "/";
+            }
             source = source.replaceAll(Pattern.quote("${fess.dictionary.path}"), dictionaryPath);
             source = source.replaceAll(Pattern.quote("${fess.dictionary.path}"), dictionaryPath);
             final CreateIndexResponse indexResponse =
             final CreateIndexResponse indexResponse =
                     client.admin().indices().prepareCreate(indexName).setSource(source, XContentFactory.xContentType(source)).execute()
                     client.admin().indices().prepareCreate(indexName).setSource(source, XContentFactory.xContentType(source)).execute()