#589 add thumbnailSupport

This commit is contained in:
Shinsuke Sugaya 2016-07-21 17:29:25 +09:00
parent d82b4f90c2
commit 93228789a3
3 changed files with 7 additions and 3 deletions

View file

@ -87,12 +87,16 @@ public abstract class FessSearchAction extends FessBaseAction {
protected boolean favoriteSupport;
protected boolean thumbnailSupport;
@Override
public ActionResponse hookBefore(final ActionRuntime runtime) { // application may override
searchLogSupport = fessConfig.isSearchLog();
favoriteSupport = fessConfig.isUserFavorite();
thumbnailSupport = fessConfig.isThumbnailEnabled();
runtime.registerData("searchLogSupport", searchLogSupport);
runtime.registerData("favoriteSupport", favoriteSupport);
runtime.registerData("thumbnailSupport", thumbnailSupport);
if (fessConfig.isWebApiPopularWord()) {
runtime.registerData("popularWords", popularWordHelper.getWordList(null, null, null, null, null));
}

View file

@ -63,7 +63,7 @@ public class ScreenshotAction extends FessSearchAction {
return true;
}).orElse(null);
final String url = DocumentUtil.getValue(doc, fessConfig.getIndexFieldUrl(), String.class);
if (StringUtil.isBlank(form.queryId) || StringUtil.isBlank(url) || screenShotManager == null) {
if (StringUtil.isBlank(form.queryId) || StringUtil.isBlank(url) || !thumbnailSupport) {
// 404
throw404("Screenshot for " + form.docId + " is not found.");
return null;

View file

@ -127,11 +127,11 @@ public class SearchAction extends FessSearchAction {
return asHtml(path_SearchJsp).renderWith(data -> {
renderData.register(data);
// favorite or screenshot
if (favoriteSupport || screenShotManager != null) {
if (favoriteSupport || thumbnailSupport) {
final String queryId = renderData.getQueryId();
final List<Map<String, Object>> documentItems = renderData.getDocumentItems();
userInfoHelper.storeQueryId(queryId, documentItems);
if (screenShotManager != null) {
if (thumbnailSupport) {
screenShotManager.storeRequest(queryId, documentItems);
RenderDataUtil.register(data, "screenShotSupport", true);
}