fix #383 : replace with content_description

This commit is contained in:
Shinsuke Sugaya 2016-04-11 23:01:06 +09:00
parent 33c66767a2
commit f2870f94a4
4 changed files with 68 additions and 5 deletions

View file

@ -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(),

View file

@ -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'. <br>
* The value is, e.g. content_title <br>
* @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'. <br>
* The value is, e.g. content_description <br>
* @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'. <br>
* The value is, e.g. url_link <br>
* @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'. <br>
* The value is, e.g. site_path <br>
* @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'. <br>
* The value is, e.g. fess <br>
@ -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);
}

View file

@ -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<Map<String, Object>> {
// 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);

View file

@ -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