fix #1874 add page size

This commit is contained in:
Shinsuke Sugaya 2018-10-18 17:56:22 +09:00
parent 31f64e09e8
commit 8a2f4e8d7e
8 changed files with 75 additions and 1 deletions

View file

@ -33,7 +33,8 @@ import org.lastaflute.web.ruts.process.ActionRuntime;
*/
public class AdminSearchlogAction extends FessAdminAction {
private static final String[] CONDITION_FIELDS = new String[] { "logType", "queryId", "userSessionId", "requestedTimeRange" };
private static final String[] CONDITION_FIELDS =
new String[] { "logType", "queryId", "userSessionId", "requestedTimeRange", "pageSize" };
// ===================================================================================
// Attribute
@ -75,6 +76,7 @@ public class AdminSearchlogAction extends FessAdminAction {
saveToken();
searchLogPager.clear();
copyBeanToBean(form, searchLogPager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
searchLogPager.setPageSize(form.getPageSize());
return asHtml(path_AdminSearchlog_AdminSearchlogJsp).renderWith(data -> {
searchPaging(data, form);
});

View file

@ -15,6 +15,10 @@
*/
package org.codelibs.fess.app.web.admin.searchlog;
import org.codelibs.fess.app.pager.SearchLogPager;
import org.codelibs.fess.util.ComponentUtil;
import org.jsoup.helper.StringUtil;
/**
* @author shinsuke
*/
@ -29,4 +33,26 @@ public class SearchForm {
public String requestedTimeRange;
public String accessType;
public String size;
public void setPageSize(final int size) {
this.size = Integer.toString(size);
}
public int getPageSize() {
if (StringUtil.isBlank(size)) {
return SearchLogPager.DEFAULT_PAGE_SIZE;
}
try {
int value = Integer.parseInt(size);
if (value <= 0 || value > ComponentUtil.getFessConfig().getPageSearchlogMaxFetchSizeAsInteger()) {
return SearchLogPager.DEFAULT_PAGE_SIZE;
}
return value;
} catch (NumberFormatException e) {
// ignore
return SearchLogPager.DEFAULT_PAGE_SIZE;
}
}
}

View file

@ -911,6 +911,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. 1000 */
String PAGE_SCORE_BOOSTER_MAX_FETCH_SIZE = "page.score.booster.max.fetch.size";
/** The key of the configuration. e.g. 10000 */
String PAGE_SEARCHLOG_MAX_FETCH_SIZE = "page.searchlog.max.fetch.size";
/** The key of the configuration. e.g. 0 */
String PAGING_SEARCH_PAGE_START = "paging.search.page.start";
@ -4356,6 +4359,21 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
Integer getPageScoreBoosterMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.searchlog.max.fetch.size'. <br>
* The value is, e.g. 10000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageSearchlogMaxFetchSize();
/**
* Get the value for the key 'page.searchlog.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 10000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageSearchlogMaxFetchSizeAsInteger();
/**
* Get the value for the key 'paging.search.page.start'. <br>
* The value is, e.g. 0 <br>
@ -7410,6 +7428,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return getAsInteger(FessConfig.PAGE_SCORE_BOOSTER_MAX_FETCH_SIZE);
}
public String getPageSearchlogMaxFetchSize() {
return get(FessConfig.PAGE_SEARCHLOG_MAX_FETCH_SIZE);
}
public Integer getPageSearchlogMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_SEARCHLOG_MAX_FETCH_SIZE);
}
public String getPagingSearchPageStart() {
return get(FessConfig.PAGING_SEARCH_PAGE_START);
}
@ -8530,6 +8556,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
defaultMap.put(FessConfig.PAGE_THUMBNAIL_QUEUE_MAX_FETCH_SIZE, "100");
defaultMap.put(FessConfig.PAGE_THUMBNAIL_PURGE_MAX_FETCH_SIZE, "100");
defaultMap.put(FessConfig.PAGE_SCORE_BOOSTER_MAX_FETCH_SIZE, "1000");
defaultMap.put(FessConfig.PAGE_SEARCHLOG_MAX_FETCH_SIZE, "10000");
defaultMap.put(FessConfig.PAGING_SEARCH_PAGE_START, "0");
defaultMap.put(FessConfig.PAGING_SEARCH_PAGE_SIZE, "10");
defaultMap.put(FessConfig.PAGING_SEARCH_PAGE_MAX_SIZE, "100");

View file

@ -484,12 +484,14 @@ page.relatedquery.max.fetch.size=5000
page.thumbnail.queue.max.fetch.size=100
page.thumbnail.purge.max.fetch.size=100
page.score.booster.max.fetch.size=1000
page.searchlog.max.fetch.size=10000
# search page
paging.search.page.start=0
paging.search.page.size=10
paging.search.page.max.size=100
thumbnail.html.image.min.width=100
thumbnail.html.image.min.height=100
thumbnail.html.image.max.aspect.ratio=3.0

View file

@ -954,6 +954,7 @@ labels.searchlog_configuration_link_top=Search Log
labels.searchlog_configuration_link_details=Details
labels.searchlog_configuration_button_back=Back
labels.searchlog_configuration_button_delete=Delete
labels.searchlog_size=Size
labels.searchlog_queryid=Query ID
labels.searchlog_usersessionid=User ID
labels.searchlog_requestedtime=Time

View file

@ -954,6 +954,7 @@ labels.searchlog_configuration_link_top=Search Log
labels.searchlog_configuration_link_details=Details
labels.searchlog_configuration_button_back=Back
labels.searchlog_configuration_button_delete=Delete
labels.searchlog_size=Size
labels.searchlog_queryid=Query ID
labels.searchlog_usersessionid=User ID
labels.searchlog_requestedtime=Time

View file

@ -954,6 +954,7 @@ labels.searchlog_configuration_link_top=検索ログ
labels.searchlog_configuration_link_details=詳細
labels.searchlog_configuration_button_back=戻る
labels.searchlog_configuration_button_delete=削除
labels.searchlog_size=サイズ
labels.searchlog_queryid=Query ID
labels.searchlog_usersessionid=User ID
labels.searchlog_requestedtime=時刻

View file

@ -94,6 +94,20 @@
<la:text styleId="requestedTimeRangeSearch" property="requestedTimeRange" styleClass="form-control datetimerange" />
</div>
</div>
<div class="form-group">
<label for="logTypeSearch" class="col-sm-2 control-label"><la:message
key="labels.searchlog_size" /></label>
<div class="col-sm-4">
<la:select styleId="size" property="size"
styleClass="form-control">
<la:option value="25">25</la:option>
<la:option value="50">50</la:option>
<la:option value="100">100</la:option>
<la:option value="200">500</la:option>
<la:option value="1000">1000</la:option>
</la:select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary" id="submit"