diff --git a/src/main/java/org/codelibs/fess/helper/QueryHelper.java b/src/main/java/org/codelibs/fess/helper/QueryHelper.java index d2013a52e..e17d268e5 100644 --- a/src/main/java/org/codelibs/fess/helper/QueryHelper.java +++ b/src/main/java/org/codelibs/fess/helper/QueryHelper.java @@ -187,7 +187,8 @@ public class QueryHelper implements Serializable { fessConfig.getIndexFieldClickCount(), fessConfig.getIndexFieldFavoriteCount() }; } if (apiResponseFieldSet == null) { - setApiResponseFields(new String[] { "urlLink", "contentDescription", fessConfig.getIndexFieldId(), + setApiResponseFields(new String[] { fessConfig.getResponseFieldContentDescription(), fessConfig.getResponseFieldContentTitle(), + fessConfig.getResponseFieldSitePath(), fessConfig.getResponseFieldUrlLink(), fessConfig.getIndexFieldId(), fessConfig.getIndexFieldDocId(), fessConfig.getIndexFieldBoost(), fessConfig.getIndexFieldContentLength(), fessConfig.getIndexFieldHost(), fessConfig.getIndexFieldSite(), fessConfig.getIndexFieldLastModified(), fessConfig.getIndexFieldTimestamp(), fessConfig.getIndexFieldMimetype(), fessConfig.getIndexFieldFiletype(), diff --git a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java index d8a6590e2..49871dae3 100644 --- a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java +++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java @@ -322,6 +322,18 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** The key of the configuration. e.g. filetype */ String INDEX_FIELD_FILETYPE = "index.field.filetype"; + /** The key of the configuration. e.g. content_title */ + String RESPONSE_FIELD_content_title = "response.field.content_title"; + + /** The key of the configuration. e.g. content_description */ + String RESPONSE_FIELD_content_description = "response.field.content_description"; + + /** The key of the configuration. e.g. url_link */ + String RESPONSE_FIELD_url_link = "response.field.url_link"; + + /** The key of the configuration. e.g. site_path */ + String RESPONSE_FIELD_site_path = "response.field.site_path"; + /** The key of the configuration. e.g. fess */ String INDEX_DOCUMENT_SEARCH_INDEX = "index.document.search.index"; @@ -1795,6 +1807,34 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction */ String getIndexFieldFiletype(); + /** + * Get the value for the key 'response.field.content_title'.
+ * The value is, e.g. content_title
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getResponseFieldContentTitle(); + + /** + * Get the value for the key 'response.field.content_description'.
+ * The value is, e.g. content_description
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getResponseFieldContentDescription(); + + /** + * Get the value for the key 'response.field.url_link'.
+ * The value is, e.g. url_link
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getResponseFieldUrlLink(); + + /** + * Get the value for the key 'response.field.site_path'.
+ * The value is, e.g. site_path
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getResponseFieldSitePath(); + /** * Get the value for the key 'index.document.search.index'.
* The value is, e.g. fess
@@ -4049,6 +4089,22 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction return get(FessConfig.INDEX_FIELD_FILETYPE); } + public String getResponseFieldContentTitle() { + return get(FessConfig.RESPONSE_FIELD_content_title); + } + + public String getResponseFieldContentDescription() { + return get(FessConfig.RESPONSE_FIELD_content_description); + } + + public String getResponseFieldUrlLink() { + return get(FessConfig.RESPONSE_FIELD_url_link); + } + + public String getResponseFieldSitePath() { + return get(FessConfig.RESPONSE_FIELD_site_path); + } + public String getIndexDocumentSearchIndex() { return get(FessConfig.INDEX_DOCUMENT_SEARCH_INDEX); } diff --git a/src/main/java/org/codelibs/fess/util/QueryResponseList.java b/src/main/java/org/codelibs/fess/util/QueryResponseList.java index 3d51c8da4..210db5a00 100644 --- a/src/main/java/org/codelibs/fess/util/QueryResponseList.java +++ b/src/main/java/org/codelibs/fess/util/QueryResponseList.java @@ -26,6 +26,7 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.codelibs.fess.helper.QueryHelper; import org.codelibs.fess.helper.ViewHelper; +import org.codelibs.fess.mylasta.direction.FessConfig; import org.dbflute.optional.OptionalEntity; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.text.Text; @@ -129,10 +130,11 @@ public class QueryResponseList implements List> { // ContentTitle final ViewHelper viewHelper = ComponentUtil.getViewHelper(); if (viewHelper != null) { - docMap.put("contentTitle", viewHelper.getContentTitle(docMap)); - docMap.put("contentDescription", viewHelper.getContentDescription(docMap)); - docMap.put("urlLink", viewHelper.getUrlLink(docMap)); - docMap.put("sitePath", viewHelper.getSitePath(docMap)); + final FessConfig fessConfig = ComponentUtil.getFessConfig(); + docMap.put(fessConfig.getResponseFieldContentTitle(), viewHelper.getContentTitle(docMap)); + docMap.put(fessConfig.getResponseFieldContentDescription(), viewHelper.getContentDescription(docMap)); + docMap.put(fessConfig.getResponseFieldUrlLink(), viewHelper.getUrlLink(docMap)); + docMap.put(fessConfig.getResponseFieldSitePath(), viewHelper.getSitePath(docMap)); } parent.add(docMap); diff --git a/src/main/resources/fess_config.properties b/src/main/resources/fess_config.properties index 802d81efb..f21d7c6f3 100644 --- a/src/main/resources/fess_config.properties +++ b/src/main/resources/fess_config.properties @@ -158,6 +158,10 @@ index.field.host=host index.field.site=site index.field.content_length=content_length index.field.filetype=filetype +response.field.content_title=content_title +response.field.content_description=content_description +response.field.url_link=url_link +response.field.site_path=site_path # document index index.document.search.index=fess