fix #1251 load default values for search_log

This commit is contained in:
Shinsuke Sugaya 2017-08-31 08:55:54 +09:00
parent cc5dc0b7b5
commit 97a19d96b6
2 changed files with 6 additions and 2 deletions

View file

@ -218,6 +218,10 @@ public class AdminBackupAction extends FessAdminAction {
addToList(entity.getQueryTime(), list);
addToList(entity.getResponseTime(), list);
addToList(entity.getRequestedAt(), list);
entity.getSearchFieldLogList().stream().forEach(e -> {
addToList(e.getFirst(), list);
addToList(e.getSecond(), list);
});
try {
writer.writeValues(list);
} catch (final IOException e) {

View file

@ -59,14 +59,14 @@ public class SearchLogBhv extends BsSearchLogBhv {
@Override
protected <RESULT extends SearchLog> RESULT createEntity(final Map<String, Object> source, final Class<? extends RESULT> entityType) {
try {
final RESULT result = entityType.newInstance();
final RESULT result = super.createEntity(source, entityType);
final Object searchFieldObj = source.get("searchField");
if (searchFieldObj instanceof Map) {
((Map<String, String>) searchFieldObj).entrySet().stream()
.forEach(e -> result.getSearchFieldLogList().add(new Pair(e.getKey(), e.getValue())));
}
return result;
} catch (InstantiationException | IllegalAccessException e) {
} catch (Exception e) {
final String msg = "Cannot create a new instance: " + entityType.getName();
throw new IllegalBehaviorStateException(msg, e);
}