Add search option for pathmap

This commit is contained in:
Ryo Kuramoto 2019-12-11 16:37:44 +09:00
parent 5ad2314dd2
commit 0147dbc3ca
No known key found for this signature in database
GPG key ID: F7A69369FE4CDA37
5 changed files with 48 additions and 6 deletions

View file

@ -21,6 +21,7 @@ import java.util.List;
import javax.annotation.Resource;
import org.codelibs.core.beans.util.BeanUtil;
import org.codelibs.core.lang.StringUtil;
import org.codelibs.fess.Constants;
import org.codelibs.fess.app.pager.PathMapPager;
import org.codelibs.fess.es.config.cbean.PathMappingCB;
@ -87,8 +88,11 @@ public class PathMappingService {
}
protected void setupListCondition(final PathMappingCB cb, final PathMapPager pathMappingPager) {
if (pathMappingPager.id != null) {
cb.query().docMeta().setId_Equal(pathMappingPager.id);
if (StringUtil.isNotBlank(pathMappingPager.regex)) {
cb.query().setRegex_Wildcard(pathMappingPager.regex);
}
if (StringUtil.isNotBlank(pathMappingPager.replacement)) {
cb.query().setReplacement_Wildcard(pathMappingPager.replacement);
}
// TODO Long, Integer, String supported only.

View file

@ -97,7 +97,7 @@ public class AdminPathmapAction extends FessAdminAction {
RenderDataUtil.register(data, "pathMappingItems", pathMappingService.getPathMappingList(pathMapPager)); // page navi
// restore from pager
copyBeanToBean(pathMapPager, form, op -> op.include("id"));
copyBeanToBean(pathMapPager, form, op -> op.include("regex", "replacement"));
}
// ===================================================================================
@ -279,7 +279,7 @@ public class AdminPathmapAction extends FessAdminAction {
RenderDataUtil.register(data, "pathMappingItems", pathMappingService.getPathMappingList(pathMapPager)); // page navi
}).useForm(SearchForm.class, setup -> {
setup.setup(form -> {
copyBeanToBean(pathMapPager, form, op -> op.include("id"));
copyBeanToBean(pathMapPager, form, op -> op.include("regex", "replacement"));
});
});
}

View file

@ -21,5 +21,8 @@ package org.codelibs.fess.app.web.admin.pathmap;
*/
public class SearchForm {
public String id;
public String regex;
public String replacement;
}

View file

@ -18,5 +18,9 @@ package org.codelibs.fess.app.web.api.admin.pathmap;
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
public class SearchBody extends BaseSearchBody {
public String id;
public String regex;
public String replacement;
}

View file

@ -36,6 +36,37 @@
</la:info>
<la:errors />
</div>
<la:form action="/admin/pathmap/"
styleClass="form-horizontal">
<div class="form-group">
<label for="regex" class="col-sm-2 control-label"><la:message
key="labels.regex" /></label>
<div class="col-sm-10">
<la:text styleId="regex" property="regex" styleClass="form-control" />
</div>
</div>
<div class="form-group">
<label for="replacement" class="col-sm-2 control-label"><la:message
key="labels.replacement" /></label>
<div class="col-sm-10">
<la:text styleId="replacement" property="replacement" styleClass="form-control" />
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary" id="submit"
name="search"
value="<la:message key="labels.crud_button_search" />">
<em class="fa fa-search"></em>
<la:message key="labels.crud_button_search" />
</button>
<button type="submit" class="btn btn-default" name="reset"
value="<la:message key="labels.crud_button_reset" />">
<la:message key="labels.crud_button_reset" />
</button>
</div>
</div>
</la:form>
<%-- List --%>
<c:if test="${pathMapPager.allRecordCount == 0}">
<div class="row top10">