fix #1250 append / to dictionaryPath

This commit is contained in:
Shinsuke Sugaya 2017-08-31 08:11:16 +09:00
parent 132be686ec
commit cc5dc0b7b5

View file

@ -396,7 +396,10 @@ public class FessEsClient implements Client {
final String indexConfigFile = indexConfigPath + "/" + index + ".json";
try {
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);
final CreateIndexResponse indexResponse =
client.admin().indices().prepareCreate(indexName).setSource(source, XContentFactory.xContentType(source)).execute()