fix #1726 add logging.search.docs.fields
This commit is contained in:
parent
994af1bcd7
commit
3187fcb776
4 changed files with 44 additions and 13 deletions
|
@ -145,10 +145,10 @@ public class SearchLogHelper {
|
|||
}
|
||||
|
||||
protected void addDocumentsInResponse(final QueryResponseList queryResponseList, final SearchLog searchLog) {
|
||||
if (ComponentUtil.getFessConfig().isLoggingSearchIncludeDocs()) {
|
||||
if (ComponentUtil.getFessConfig().isLoggingSearchDocsEnabled()) {
|
||||
queryResponseList.stream().forEach(res -> {
|
||||
final Map<String, Object> map = new HashMap<>();
|
||||
Arrays.stream(ComponentUtil.getQueryHelper().getResponseFields()).forEach(s -> map.put(s, res.get(s)));
|
||||
Arrays.stream(ComponentUtil.getFessConfig().getLoggingSearchDocsFieldsAsArray()).forEach(s -> map.put(s, res.get(s)));
|
||||
searchLog.addDocument(map);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -753,7 +753,10 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
String INDEX_BACKUP_LOG_TARGETS = "index.backup.log.targets";
|
||||
|
||||
/** The key of the configuration. e.g. true */
|
||||
String LOGGING_SEARCH_INCLUDE_DOCS = "logging.search.include.docs";
|
||||
String LOGGING_SEARCH_DOCS_ENABLED = "logging.search.docs.enabled";
|
||||
|
||||
/** The key of the configuration. e.g. filetype,created,click_count,title,doc_id,url,score,site,filename,host,digest,boost,mimetype,favorite_count,_id,lang,last_modified,content_length,timestamp */
|
||||
String LOGGING_SEARCH_DOCS_FIELDS = "logging.search.docs.fields";
|
||||
|
||||
/** The key of the configuration. e.g. 4000 */
|
||||
String FORM_ADMIN_MAX_INPUT_SIZE = "form.admin.max.input.size";
|
||||
|
@ -3598,20 +3601,27 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
String getIndexBackupLogTargets();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'logging.search.include.docs'. <br>
|
||||
* Get the value for the key 'logging.search.docs.enabled'. <br>
|
||||
* The value is, e.g. true <br>
|
||||
* comment: logging
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
*/
|
||||
String getLoggingSearchIncludeDocs();
|
||||
String getLoggingSearchDocsEnabled();
|
||||
|
||||
/**
|
||||
* Is the property for the key 'logging.search.include.docs' true? <br>
|
||||
* Is the property for the key 'logging.search.docs.enabled' true? <br>
|
||||
* The value is, e.g. true <br>
|
||||
* comment: logging
|
||||
* @return The determination, true or false. (if not found, exception but basically no way)
|
||||
*/
|
||||
boolean isLoggingSearchIncludeDocs();
|
||||
boolean isLoggingSearchDocsEnabled();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'logging.search.docs.fields'. <br>
|
||||
* The value is, e.g. filetype,created,click_count,title,doc_id,url,score,site,filename,host,digest,boost,mimetype,favorite_count,_id,lang,last_modified,content_length,timestamp <br>
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
*/
|
||||
String getLoggingSearchDocsFields();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'form.admin.max.input.size'. <br>
|
||||
|
@ -6983,12 +6993,16 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
return get(FessConfig.INDEX_BACKUP_LOG_TARGETS);
|
||||
}
|
||||
|
||||
public String getLoggingSearchIncludeDocs() {
|
||||
return get(FessConfig.LOGGING_SEARCH_INCLUDE_DOCS);
|
||||
public String getLoggingSearchDocsEnabled() {
|
||||
return get(FessConfig.LOGGING_SEARCH_DOCS_ENABLED);
|
||||
}
|
||||
|
||||
public boolean isLoggingSearchIncludeDocs() {
|
||||
return is(FessConfig.LOGGING_SEARCH_INCLUDE_DOCS);
|
||||
public boolean isLoggingSearchDocsEnabled() {
|
||||
return is(FessConfig.LOGGING_SEARCH_DOCS_ENABLED);
|
||||
}
|
||||
|
||||
public String getLoggingSearchDocsFields() {
|
||||
return get(FessConfig.LOGGING_SEARCH_DOCS_FIELDS);
|
||||
}
|
||||
|
||||
public String getFormAdminMaxInputSize() {
|
||||
|
@ -8429,7 +8443,10 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
defaultMap.put(FessConfig.FTP_ROLE_FROM_FILE, "true");
|
||||
defaultMap.put(FessConfig.INDEX_BACKUP_TARGETS, ".fess_basic_config.bulk,.fess_config.bulk,.fess_user.bulk,system.properties");
|
||||
defaultMap.put(FessConfig.INDEX_BACKUP_LOG_TARGETS, "click_log.ndjson,favorite_log.ndjson,search_log.ndjson,user_info.ndjson");
|
||||
defaultMap.put(FessConfig.LOGGING_SEARCH_INCLUDE_DOCS, "true");
|
||||
defaultMap.put(FessConfig.LOGGING_SEARCH_DOCS_ENABLED, "true");
|
||||
defaultMap
|
||||
.put(FessConfig.LOGGING_SEARCH_DOCS_FIELDS,
|
||||
"filetype,created,click_count,title,doc_id,url,score,site,filename,host,digest,boost,mimetype,favorite_count,_id,lang,last_modified,content_length,timestamp");
|
||||
defaultMap.put(FessConfig.FORM_ADMIN_MAX_INPUT_SIZE, "4000");
|
||||
defaultMap.put(FessConfig.AUTHENTICATION_ADMIN_USERS, "admin");
|
||||
defaultMap.put(FessConfig.AUTHENTICATION_ADMIN_ROLES, "admin");
|
||||
|
|
|
@ -69,6 +69,8 @@ import org.lastaflute.web.validation.theme.typed.LongTypeValidator;
|
|||
|
||||
public interface FessProp {
|
||||
|
||||
public static final String LOGGING_SEARCH_DOCS_FIELDS = "loggingSearchDocsFields";
|
||||
|
||||
public static final String API_SEARCH_ACCEPT_REFERERS = "apiSearchAcceptReferers";
|
||||
|
||||
public static final String QUERY_GSA_RESPONSE_FIELDS = "queryGsaResponseFields";
|
||||
|
@ -1831,4 +1833,15 @@ public interface FessProp {
|
|||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
String getLoggingSearchDocsFields();
|
||||
|
||||
public default String[] getLoggingSearchDocsFieldsAsArray() {
|
||||
String[] fields = (String[]) propMap.get(LOGGING_SEARCH_DOCS_FIELDS);
|
||||
if (fields == null) {
|
||||
fields = split(getLoggingSearchDocsFields(), ",").get(stream -> stream.map(String::trim).toArray(n -> new String[n]));
|
||||
propMap.put(LOGGING_SEARCH_DOCS_FIELDS, fields);
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -397,7 +397,8 @@ index.backup.targets=.fess_basic_config.bulk,.fess_config.bulk,.fess_user.bulk,s
|
|||
index.backup.log.targets=click_log.ndjson,favorite_log.ndjson,search_log.ndjson,user_info.ndjson
|
||||
|
||||
# logging
|
||||
logging.search.include.docs=true
|
||||
logging.search.docs.enabled=true
|
||||
logging.search.docs.fields=filetype,created,click_count,title,doc_id,url,score,site,filename,host,digest,boost,mimetype,favorite_count,_id,lang,last_modified,content_length,timestamp
|
||||
|
||||
# ========================================================================================
|
||||
# Web
|
||||
|
|
Loading…
Add table
Reference in a new issue