|
@@ -248,6 +248,7 @@ public class SearchEngineClient implements Client {
|
|
if (runner == null) {
|
|
if (runner == null) {
|
|
switch (fessConfig.getFesenType()) {
|
|
switch (fessConfig.getFesenType()) {
|
|
case Constants.FESEN_TYPE_CLOUD:
|
|
case Constants.FESEN_TYPE_CLOUD:
|
|
|
|
+ case Constants.FESEN_TYPE_AWS:
|
|
httpAddress = org.codelibs.fess.util.ResourceUtil.getFesenHttpUrl();
|
|
httpAddress = org.codelibs.fess.util.ResourceUtil.getFesenHttpUrl();
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
@@ -400,6 +401,7 @@ public class SearchEngineClient implements Client {
|
|
if (uploadConfig) {
|
|
if (uploadConfig) {
|
|
switch (fesenType) {
|
|
switch (fesenType) {
|
|
case Constants.FESEN_TYPE_CLOUD:
|
|
case Constants.FESEN_TYPE_CLOUD:
|
|
|
|
+ case Constants.FESEN_TYPE_AWS:
|
|
// nothing
|
|
// nothing
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
@@ -411,15 +413,7 @@ public class SearchEngineClient implements Client {
|
|
|
|
|
|
final String indexConfigFile = getResourcePath(indexConfigPath, fesenType, "/" + index + ".json");
|
|
final String indexConfigFile = getResourcePath(indexConfigPath, fesenType, "/" + index + ".json");
|
|
try {
|
|
try {
|
|
- String source = FileUtil.readUTF8(indexConfigFile);
|
|
|
|
- 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.index.codec}"), fessConfig.getIndexCodec());
|
|
|
|
- source = source.replaceAll(Pattern.quote("${fess.index.number_of_shards}"), numberOfShards);
|
|
|
|
- source = source.replaceAll(Pattern.quote("${fess.index.auto_expand_replicas}"), autoExpandReplicas);
|
|
|
|
|
|
+ final String source = readIndexSetting(fesenType, indexConfigFile, numberOfShards, autoExpandReplicas);
|
|
final CreateIndexResponse indexResponse = client.admin().indices().prepareCreate(indexName).setSource(source, XContentType.JSON)
|
|
final CreateIndexResponse indexResponse = client.admin().indices().prepareCreate(indexName).setSource(source, XContentType.JSON)
|
|
.execute().actionGet(fessConfig.getIndexIndicesTimeout());
|
|
.execute().actionGet(fessConfig.getIndexIndicesTimeout());
|
|
if (indexResponse.isAcknowledged()) {
|
|
if (indexResponse.isAcknowledged()) {
|
|
@@ -435,6 +429,21 @@ public class SearchEngineClient implements Client {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ protected String readIndexSetting(final String fesenType, final String indexConfigFile, final String numberOfShards,
|
|
|
|
+ final String autoExpandReplicas) {
|
|
|
|
+ final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
|
|
|
+ String source = FileUtil.readUTF8(indexConfigFile);
|
|
|
|
+ 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.index.codec}"), fessConfig.getIndexCodec());
|
|
|
|
+ source = source.replaceAll(Pattern.quote("${fess.index.number_of_shards}"), numberOfShards);
|
|
|
|
+ source = source.replaceAll(Pattern.quote("${fess.index.auto_expand_replicas}"), autoExpandReplicas);
|
|
|
|
+ return source;
|
|
|
|
+ }
|
|
|
|
+
|
|
protected String getResourcePath(final String basePath, final String type, final String path) {
|
|
protected String getResourcePath(final String basePath, final String type, final String path) {
|
|
final String target = basePath + "/_" + type + path;
|
|
final String target = basePath + "/_" + type + path;
|
|
if (ResourceUtil.getResourceNoException(target) != null) {
|
|
if (ResourceUtil.getResourceNoException(target) != null) {
|