fix #2617 import old backup data
This commit is contained in:
parent
57706e02c1
commit
82418be2b0
1 changed files with 9 additions and 3 deletions
|
@ -193,15 +193,21 @@ public class AdminBackupAction extends FessAdminAction {
|
|||
while ((line = br.readLine()) != null) {
|
||||
if (StringUtil.isNotBlank(line)) {
|
||||
final Map<String, Map<String, String>> dataObj;
|
||||
if (line.contains("_type")) {
|
||||
if (line.contains("\"_index\"") || line.contains("\"_type\"")) {
|
||||
dataObj = parseObject(mapper, line);
|
||||
} else {
|
||||
dataObj = null;
|
||||
}
|
||||
if (dataObj != null) {
|
||||
final Map<String, String> indexObj = dataObj.get("index");
|
||||
if (indexObj != null && indexObj.containsKey("_type")) {
|
||||
indexObj.remove("_type");
|
||||
if (indexObj != null) {
|
||||
if (indexObj.containsKey("_type")) {
|
||||
indexObj.remove("_type");
|
||||
}
|
||||
final String index = indexObj.get("_index");
|
||||
if (index != null && index.startsWith(".fess")) {
|
||||
indexObj.put("_index", index.substring(1));
|
||||
}
|
||||
bw.write(mapper.writeValueAsString(dataObj));
|
||||
} else {
|
||||
bw.write(line);
|
||||
|
|
Loading…
Add table
Reference in a new issue