Merge pull request #2370 from deka0106/issue-2368
#2368: wrap search options with asterisk
This commit is contained in:
commit
d11f66691e
11 changed files with 64 additions and 32 deletions
|
@ -30,7 +30,7 @@ import org.codelibs.fess.mylasta.direction.FessConfig;
|
|||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
|
||||
public class BoostDocumentRuleService {
|
||||
public class BoostDocumentRuleService extends FessAppService {
|
||||
|
||||
@Resource
|
||||
protected BoostDocumentRuleBhv boostDocumentRuleBhv;
|
||||
|
@ -71,10 +71,10 @@ public class BoostDocumentRuleService {
|
|||
|
||||
protected void setupListCondition(final BoostDocumentRuleCB cb, final BoostDocPager boostDocumentRulePager) {
|
||||
if (StringUtil.isNotBlank(boostDocumentRulePager.urlExpr)) {
|
||||
cb.query().setUrlExpr_Wildcard(boostDocumentRulePager.urlExpr);
|
||||
cb.query().setUrlExpr_Wildcard(wrapQuery(boostDocumentRulePager.urlExpr));
|
||||
}
|
||||
if (StringUtil.isNotBlank(boostDocumentRulePager.boostExpr)) {
|
||||
cb.query().setBoostExpr_Wildcard(boostDocumentRulePager.boostExpr);
|
||||
cb.query().setBoostExpr_Wildcard(wrapQuery(boostDocumentRulePager.boostExpr));
|
||||
}
|
||||
// TODO Long, Integer, String supported only.
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.codelibs.fess.util.ParameterUtil;
|
|||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
|
||||
public class DataConfigService {
|
||||
public class DataConfigService extends FessAppService {
|
||||
|
||||
@Resource
|
||||
protected DataConfigBhv dataConfigBhv;
|
||||
|
@ -79,10 +79,10 @@ public class DataConfigService {
|
|||
cb.query().setName_Wildcard(dataConfigPager.name);
|
||||
}
|
||||
if (StringUtil.isNotBlank(dataConfigPager.handlerName)) {
|
||||
cb.query().setHandlerName_Wildcard(dataConfigPager.handlerName);
|
||||
cb.query().setHandlerName_Wildcard(wrapQuery(dataConfigPager.handlerName));
|
||||
}
|
||||
if (StringUtil.isNotBlank(dataConfigPager.description)) {
|
||||
cb.query().setDescription_Wildcard(dataConfigPager.description);
|
||||
cb.query().setDescription_Wildcard(wrapQuery(dataConfigPager.description));
|
||||
}
|
||||
// TODO Long, Integer, String supported only.
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.codelibs.fess.mylasta.direction.FessConfig;
|
|||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
|
||||
public class DuplicateHostService {
|
||||
public class DuplicateHostService extends FessAppService {
|
||||
|
||||
@Resource
|
||||
protected DuplicateHostBhv duplicateHostBhv;
|
||||
|
@ -86,10 +86,10 @@ public class DuplicateHostService {
|
|||
|
||||
protected void setupListCondition(final DuplicateHostCB cb, final DuplicateHostPager duplicateHostPager) {
|
||||
if (StringUtil.isNotBlank(duplicateHostPager.regularName)) {
|
||||
cb.query().setRegularName_Wildcard(duplicateHostPager.regularName);
|
||||
cb.query().setRegularName_Wildcard(wrapQuery(duplicateHostPager.regularName));
|
||||
}
|
||||
if (StringUtil.isNotBlank(duplicateHostPager.duplicateHostName)) {
|
||||
cb.query().setDuplicateHostName_Wildcard(duplicateHostPager.duplicateHostName);
|
||||
cb.query().setDuplicateHostName_Wildcard(wrapQuery(duplicateHostPager.duplicateHostName));
|
||||
}
|
||||
// TODO Long, Integer, String supported only.
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright 2012-2020 CodeLibs Project and the Others.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.codelibs.fess.app.service;
|
||||
|
||||
public abstract class FessAppService {
|
||||
|
||||
protected static String wrapQuery(final String query) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
if (!query.startsWith("*")) {
|
||||
sb.append("*");
|
||||
}
|
||||
sb.append(query);
|
||||
if (!query.endsWith("*")) {
|
||||
sb.append("*");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -32,7 +32,7 @@ import org.codelibs.fess.util.ParameterUtil;
|
|||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
|
||||
public class FileConfigService {
|
||||
public class FileConfigService extends FessAppService {
|
||||
|
||||
@Resource
|
||||
protected FileConfigBhv fileConfigBhv;
|
||||
|
@ -85,13 +85,13 @@ public class FileConfigService {
|
|||
|
||||
protected void setupListCondition(final FileConfigCB cb, final FileConfigPager fileConfigPager) {
|
||||
if (StringUtil.isNotBlank(fileConfigPager.name)) {
|
||||
cb.query().setName_Wildcard(fileConfigPager.name);
|
||||
cb.query().setName_Wildcard(wrapQuery(fileConfigPager.name));
|
||||
}
|
||||
if (StringUtil.isNotBlank(fileConfigPager.paths)) {
|
||||
cb.query().setPaths_Wildcard(fileConfigPager.paths);
|
||||
cb.query().setPaths_Wildcard(wrapQuery(fileConfigPager.paths));
|
||||
}
|
||||
if (StringUtil.isNotBlank(fileConfigPager.description)) {
|
||||
cb.query().setDescription_Wildcard(fileConfigPager.description);
|
||||
cb.query().setDescription_Wildcard(wrapQuery(fileConfigPager.description));
|
||||
}
|
||||
// TODO Long, Integer, String supported only.
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.codelibs.fess.mylasta.direction.FessConfig;
|
|||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
|
||||
public class KeyMatchService {
|
||||
public class KeyMatchService extends FessAppService {
|
||||
|
||||
@Resource
|
||||
protected KeyMatchBhv keyMatchBhv;
|
||||
|
@ -76,10 +76,10 @@ public class KeyMatchService {
|
|||
|
||||
protected void setupListCondition(final KeyMatchCB cb, final KeyMatchPager keyMatchPager) {
|
||||
if (StringUtil.isNotBlank(keyMatchPager.term)) {
|
||||
cb.query().setTerm_Wildcard(keyMatchPager.term);
|
||||
cb.query().setTerm_Wildcard(wrapQuery(keyMatchPager.term));
|
||||
}
|
||||
if (StringUtil.isNotBlank(keyMatchPager.query)) {
|
||||
cb.query().setQuery_Wildcard(keyMatchPager.query);
|
||||
cb.query().setQuery_Wildcard(wrapQuery(keyMatchPager.query));
|
||||
}
|
||||
// TODO Long, Integer, String supported only.
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.codelibs.fess.util.ComponentUtil;
|
|||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
|
||||
public class LabelTypeService {
|
||||
public class LabelTypeService extends FessAppService {
|
||||
|
||||
@Resource
|
||||
protected LabelTypeBhv labelTypeBhv;
|
||||
|
@ -70,10 +70,10 @@ public class LabelTypeService {
|
|||
|
||||
protected void setupListCondition(final LabelTypeCB cb, final LabelTypePager labelTypePager) {
|
||||
if (StringUtil.isNotBlank(labelTypePager.name)) {
|
||||
cb.query().setName_Wildcard(labelTypePager.name);
|
||||
cb.query().setName_Wildcard(wrapQuery(labelTypePager.name));
|
||||
}
|
||||
if (StringUtil.isNotBlank(labelTypePager.value)) {
|
||||
cb.query().setValue_Wildcard(labelTypePager.value);
|
||||
cb.query().setValue_Wildcard(wrapQuery(labelTypePager.value));
|
||||
}
|
||||
// TODO Long, Integer, String supported only.
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.codelibs.fess.util.ComponentUtil;
|
|||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
|
||||
public class PathMappingService {
|
||||
public class PathMappingService extends FessAppService {
|
||||
|
||||
@Resource
|
||||
protected PathMappingBhv pathMappingBhv;
|
||||
|
@ -89,10 +89,10 @@ public class PathMappingService {
|
|||
|
||||
protected void setupListCondition(final PathMappingCB cb, final PathMapPager pathMappingPager) {
|
||||
if (StringUtil.isNotBlank(pathMappingPager.regex)) {
|
||||
cb.query().setRegex_Wildcard(pathMappingPager.regex);
|
||||
cb.query().setRegex_Wildcard(wrapQuery(pathMappingPager.regex));
|
||||
}
|
||||
if (StringUtil.isNotBlank(pathMappingPager.replacement)) {
|
||||
cb.query().setReplacement_Wildcard(pathMappingPager.replacement);
|
||||
cb.query().setReplacement_Wildcard(wrapQuery(pathMappingPager.replacement));
|
||||
}
|
||||
// TODO Long, Integer, String supported only.
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.codelibs.fess.util.ComponentUtil;
|
|||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
|
||||
public class RelatedContentService {
|
||||
public class RelatedContentService extends FessAppService {
|
||||
|
||||
@Resource
|
||||
protected RelatedContentBhv relatedContentBhv;
|
||||
|
@ -72,10 +72,10 @@ public class RelatedContentService {
|
|||
|
||||
protected void setupListCondition(final RelatedContentCB cb, final RelatedContentPager relatedContentPager) {
|
||||
if (StringUtil.isNotBlank(relatedContentPager.term)) {
|
||||
cb.query().setTerm_Wildcard(relatedContentPager.term);
|
||||
cb.query().setTerm_Wildcard(wrapQuery(relatedContentPager.term));
|
||||
}
|
||||
if (StringUtil.isNotBlank(relatedContentPager.content)) {
|
||||
cb.query().setContent_Wildcard(relatedContentPager.content);
|
||||
cb.query().setContent_Wildcard(wrapQuery(relatedContentPager.content));
|
||||
}
|
||||
// TODO Long, Integer, String supported only.
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.codelibs.fess.util.ComponentUtil;
|
|||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
|
||||
public class RelatedQueryService {
|
||||
public class RelatedQueryService extends FessAppService {
|
||||
|
||||
@Resource
|
||||
protected RelatedQueryBhv relatedQueryBhv;
|
||||
|
@ -72,10 +72,10 @@ public class RelatedQueryService {
|
|||
|
||||
protected void setupListCondition(final RelatedQueryCB cb, final RelatedQueryPager relatedQueryPager) {
|
||||
if (StringUtil.isNotBlank(relatedQueryPager.term)) {
|
||||
cb.query().setTerm_Wildcard(relatedQueryPager.term);
|
||||
cb.query().setTerm_Wildcard(wrapQuery(relatedQueryPager.term));
|
||||
}
|
||||
if (StringUtil.isNotBlank(relatedQueryPager.queries)) {
|
||||
cb.query().setQueries_Wildcard(relatedQueryPager.queries);
|
||||
cb.query().setQueries_Wildcard(wrapQuery(relatedQueryPager.queries));
|
||||
}
|
||||
// TODO Long, Integer, String supported only.
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.codelibs.fess.util.ParameterUtil;
|
|||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
|
||||
public class WebConfigService {
|
||||
public class WebConfigService extends FessAppService {
|
||||
|
||||
@Resource
|
||||
protected WebConfigBhv webConfigBhv;
|
||||
|
@ -93,13 +93,13 @@ public class WebConfigService {
|
|||
|
||||
protected void setupListCondition(final WebConfigCB cb, final WebConfigPager webConfigPager) {
|
||||
if (StringUtil.isNotBlank(webConfigPager.name)) {
|
||||
cb.query().setName_Wildcard(webConfigPager.name);
|
||||
cb.query().setName_Wildcard(wrapQuery(webConfigPager.name));
|
||||
}
|
||||
if (StringUtil.isNotBlank(webConfigPager.urls)) {
|
||||
cb.query().setUrls_Wildcard(webConfigPager.urls);
|
||||
cb.query().setUrls_Wildcard(wrapQuery(webConfigPager.urls));
|
||||
}
|
||||
if (StringUtil.isNotBlank(webConfigPager.description)) {
|
||||
cb.query().setDescription_Wildcard(webConfigPager.description);
|
||||
cb.query().setDescription_Wildcard(wrapQuery(webConfigPager.description));
|
||||
}
|
||||
// TODO Long, Integer, String supported only.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue