fix labelTypes of SuggestElevateWord
This commit is contained in:
parent
3b63aa5469
commit
d9d820b9bc
21 changed files with 1591 additions and 22 deletions
|
@ -624,6 +624,21 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"suggest_elevate_word_to_label" : {
|
||||
"_all" : {
|
||||
"enabled" : false
|
||||
},
|
||||
"properties" : {
|
||||
"suggestElevateWordId" : {
|
||||
"type" : "string",
|
||||
"index" : "not_analyzed"
|
||||
},
|
||||
"labelTypeId" : {
|
||||
"type" : "string",
|
||||
"index" : "not_analyzed"
|
||||
}
|
||||
}
|
||||
},
|
||||
"suggest_elevate_word" : {
|
||||
"_all" : {
|
||||
"enabled" : false
|
||||
|
|
|
@ -33,7 +33,9 @@ import org.codelibs.fess.Constants;
|
|||
import org.codelibs.fess.app.pager.SuggestElevateWordPager;
|
||||
import org.codelibs.fess.es.config.cbean.SuggestElevateWordCB;
|
||||
import org.codelibs.fess.es.config.exbhv.SuggestElevateWordBhv;
|
||||
import org.codelibs.fess.es.config.exbhv.SuggestElevateWordToLabelBhv;
|
||||
import org.codelibs.fess.es.config.exentity.SuggestElevateWord;
|
||||
import org.codelibs.fess.es.config.exentity.SuggestElevateWordToLabel;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
import org.dbflute.bhv.readable.EntityRowHandler;
|
||||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
|
@ -49,6 +51,9 @@ public class SuggestElevateWordService implements Serializable {
|
|||
|
||||
private static final Log log = LogFactory.getLog(SuggestElevateWordService.class);
|
||||
|
||||
@Resource
|
||||
protected SuggestElevateWordToLabelBhv suggestElevateWordToLabelBhv;
|
||||
|
||||
@Resource
|
||||
protected SuggestElevateWordBhv suggestElevateWordBhv;
|
||||
|
||||
|
@ -73,16 +78,79 @@ public class SuggestElevateWordService implements Serializable {
|
|||
}
|
||||
|
||||
public OptionalEntity<SuggestElevateWord> getSuggestElevateWord(final String id) {
|
||||
return suggestElevateWordBhv.selectByPK(id);
|
||||
return suggestElevateWordBhv.selectByPK(id).map(entity -> {
|
||||
|
||||
final List<SuggestElevateWordToLabel> wctltmList = suggestElevateWordToLabelBhv.selectList(wctltmCb -> {
|
||||
wctltmCb.query().setSuggestElevateWordId_Equal(entity.getId());
|
||||
});
|
||||
if (!wctltmList.isEmpty()) {
|
||||
final List<String> labelTypeIds = new ArrayList<String>(wctltmList.size());
|
||||
for (final SuggestElevateWordToLabel mapping : wctltmList) {
|
||||
labelTypeIds.add(mapping.getLabelTypeId());
|
||||
}
|
||||
entity.setLabelTypeIds(labelTypeIds.toArray(new String[labelTypeIds.size()]));
|
||||
}
|
||||
return entity;
|
||||
});
|
||||
}
|
||||
|
||||
public void store(final SuggestElevateWord suggestElevateWord) {
|
||||
final boolean isNew = suggestElevateWord.getId() == null;
|
||||
final String[] labelTypeIds = suggestElevateWord.getLabelTypeIds();
|
||||
setupStoreCondition(suggestElevateWord);
|
||||
|
||||
suggestElevateWordBhv.insertOrUpdate(suggestElevateWord, op -> {
|
||||
op.setRefresh(true);
|
||||
});
|
||||
|
||||
final String suggestElevateWordId = suggestElevateWord.getId();
|
||||
if (isNew) {
|
||||
// Insert
|
||||
if (labelTypeIds != null) {
|
||||
final List<SuggestElevateWordToLabel> wctltmList = new ArrayList<SuggestElevateWordToLabel>();
|
||||
for (final String id : labelTypeIds) {
|
||||
final SuggestElevateWordToLabel mapping = new SuggestElevateWordToLabel();
|
||||
mapping.setSuggestElevateWordId(suggestElevateWordId);
|
||||
mapping.setLabelTypeId(id);
|
||||
wctltmList.add(mapping);
|
||||
}
|
||||
suggestElevateWordToLabelBhv.batchInsert(wctltmList, op -> {
|
||||
op.setRefresh(true);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Update
|
||||
if (labelTypeIds != null) {
|
||||
final List<SuggestElevateWordToLabel> list = suggestElevateWordToLabelBhv.selectList(wctltmCb -> {
|
||||
wctltmCb.query().setSuggestElevateWordId_Equal(suggestElevateWordId);
|
||||
});
|
||||
final List<SuggestElevateWordToLabel> newList = new ArrayList<SuggestElevateWordToLabel>();
|
||||
final List<SuggestElevateWordToLabel> matchedList = new ArrayList<SuggestElevateWordToLabel>();
|
||||
for (final String id : labelTypeIds) {
|
||||
boolean exist = false;
|
||||
for (final SuggestElevateWordToLabel mapping : list) {
|
||||
if (mapping.getLabelTypeId().equals(id)) {
|
||||
exist = true;
|
||||
matchedList.add(mapping);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!exist) {
|
||||
// new
|
||||
final SuggestElevateWordToLabel mapping = new SuggestElevateWordToLabel();
|
||||
mapping.setSuggestElevateWordId(suggestElevateWordId);
|
||||
mapping.setLabelTypeId(id);
|
||||
newList.add(mapping);
|
||||
}
|
||||
}
|
||||
list.removeAll(matchedList);
|
||||
suggestElevateWordToLabelBhv.batchInsert(newList, op -> {
|
||||
op.setRefresh(true);
|
||||
});
|
||||
suggestElevateWordToLabelBhv.batchDelete(list, op -> {
|
||||
op.setRefresh(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void delete(final SuggestElevateWord suggestElevateWord) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.codelibs.core.io.CopyUtil;
|
|||
import org.codelibs.core.misc.DynamicProperties;
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.SuggestElevateWordPager;
|
||||
import org.codelibs.fess.app.service.LabelTypeService;
|
||||
import org.codelibs.fess.app.service.SuggestElevateWordService;
|
||||
import org.codelibs.fess.app.web.CrudMode;
|
||||
import org.codelibs.fess.app.web.base.FessAdminAction;
|
||||
|
@ -69,6 +70,8 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
protected DynamicProperties crawlerProperties;
|
||||
@Resource
|
||||
protected SuggestHelper suggestHelper;
|
||||
@Resource
|
||||
private LabelTypeService labelTypeService;
|
||||
|
||||
// ===================================================================================
|
||||
// Hook
|
||||
|
@ -138,6 +141,8 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
form.initialize();
|
||||
form.crudMode = CrudMode.CREATE;
|
||||
});
|
||||
}).renderWith(data -> {
|
||||
registerLabels(data);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -162,7 +167,9 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), toEditHtml());
|
||||
});
|
||||
return asHtml(next);
|
||||
return asHtml(next).renderWith(data -> {
|
||||
registerLabels(data);
|
||||
});
|
||||
}
|
||||
|
||||
// -----------------------------------------------------
|
||||
|
@ -182,6 +189,8 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), toEditHtml());
|
||||
});
|
||||
});
|
||||
}).renderWith(data -> {
|
||||
registerLabels(data);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -229,7 +238,7 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
getSuggestElevateWord(form).ifPresent(
|
||||
entity -> {
|
||||
suggestElevateWordService.store(entity);
|
||||
suggestHelper.addElevateWord(entity.getSuggestWord(), entity.getReading(), entity.getTargetLabel(),
|
||||
suggestHelper.addElevateWord(entity.getSuggestWord(), entity.getReading(), entity.getLabelTypeValues(),
|
||||
entity.getTargetRole(), entity.getBoost());
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
}).orElse(() -> {
|
||||
|
@ -360,6 +369,10 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
});
|
||||
}
|
||||
|
||||
protected void registerLabels(final RenderData data) {
|
||||
data.register("labelTypeItems", labelTypeService.getLabelTypeList());
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Small Helper
|
||||
// ============
|
||||
|
|
|
@ -31,6 +31,8 @@ public class CreateForm implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String[] labelTypeIds;
|
||||
|
||||
@ValidateTypeFailure
|
||||
public Integer crudMode;
|
||||
|
||||
|
|
|
@ -0,0 +1,249 @@
|
|||
/*
|
||||
* Copyright 2012-2015 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.es.config.bsbhv;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.codelibs.fess.es.config.allcommon.EsAbstractBehavior;
|
||||
import org.codelibs.fess.es.config.allcommon.EsAbstractEntity;
|
||||
import org.codelibs.fess.es.config.allcommon.EsAbstractEntity.RequestOptionCall;
|
||||
import org.codelibs.fess.es.config.bsentity.dbmeta.SuggestElevateWordToLabelDbm;
|
||||
import org.codelibs.fess.es.config.cbean.SuggestElevateWordToLabelCB;
|
||||
import org.codelibs.fess.es.config.exentity.SuggestElevateWordToLabel;
|
||||
import org.dbflute.Entity;
|
||||
import org.dbflute.bhv.readable.CBCall;
|
||||
import org.dbflute.bhv.readable.EntityRowHandler;
|
||||
import org.dbflute.cbean.ConditionBean;
|
||||
import org.dbflute.cbean.result.ListResultBean;
|
||||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.dbflute.exception.IllegalBehaviorStateException;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
import org.dbflute.util.DfTypeUtil;
|
||||
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
||||
import org.elasticsearch.action.delete.DeleteRequestBuilder;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
|
||||
/**
|
||||
* @author ESFlute (using FreeGen)
|
||||
*/
|
||||
public abstract class BsSuggestElevateWordToLabelBhv extends EsAbstractBehavior<SuggestElevateWordToLabel, SuggestElevateWordToLabelCB> {
|
||||
|
||||
// ===================================================================================
|
||||
// Control Override
|
||||
// ================
|
||||
@Override
|
||||
public String asTableDbName() {
|
||||
return asEsIndexType();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String asEsIndex() {
|
||||
return ".fess_config";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String asEsIndexType() {
|
||||
return "suggest_elevate_word_to_label";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String asEsSearchType() {
|
||||
return "suggest_elevate_word_to_label";
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuggestElevateWordToLabelDbm asDBMeta() {
|
||||
return SuggestElevateWordToLabelDbm.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <RESULT extends SuggestElevateWordToLabel> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
|
||||
try {
|
||||
final RESULT result = entityType.newInstance();
|
||||
result.setSuggestElevateWordId(DfTypeUtil.toString(source.get("suggestElevateWordId")));
|
||||
result.setLabelTypeId(DfTypeUtil.toString(source.get("labelTypeId")));
|
||||
return result;
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
final String msg = "Cannot create a new instance: " + entityType.getName();
|
||||
throw new IllegalBehaviorStateException(msg, e);
|
||||
}
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Select
|
||||
// ======
|
||||
public int selectCount(CBCall<SuggestElevateWordToLabelCB> cbLambda) {
|
||||
return facadeSelectCount(createCB(cbLambda));
|
||||
}
|
||||
|
||||
public OptionalEntity<SuggestElevateWordToLabel> selectEntity(CBCall<SuggestElevateWordToLabelCB> cbLambda) {
|
||||
return facadeSelectEntity(createCB(cbLambda));
|
||||
}
|
||||
|
||||
protected OptionalEntity<SuggestElevateWordToLabel> facadeSelectEntity(SuggestElevateWordToLabelCB cb) {
|
||||
return doSelectOptionalEntity(cb, typeOfSelectedEntity());
|
||||
}
|
||||
|
||||
protected <ENTITY extends SuggestElevateWordToLabel> OptionalEntity<ENTITY> doSelectOptionalEntity(SuggestElevateWordToLabelCB cb,
|
||||
Class<? extends ENTITY> tp) {
|
||||
return createOptionalEntity(doSelectEntity(cb, tp), cb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuggestElevateWordToLabelCB newConditionBean() {
|
||||
return new SuggestElevateWordToLabelCB();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Entity doReadEntity(ConditionBean cb) {
|
||||
return facadeSelectEntity(downcast(cb)).orElse(null);
|
||||
}
|
||||
|
||||
public SuggestElevateWordToLabel selectEntityWithDeletedCheck(CBCall<SuggestElevateWordToLabelCB> cbLambda) {
|
||||
return facadeSelectEntityWithDeletedCheck(createCB(cbLambda));
|
||||
}
|
||||
|
||||
public OptionalEntity<SuggestElevateWordToLabel> selectByPK(String id) {
|
||||
return facadeSelectByPK(id);
|
||||
}
|
||||
|
||||
protected OptionalEntity<SuggestElevateWordToLabel> facadeSelectByPK(String id) {
|
||||
return doSelectOptionalByPK(id, typeOfSelectedEntity());
|
||||
}
|
||||
|
||||
protected <ENTITY extends SuggestElevateWordToLabel> ENTITY doSelectByPK(String id, Class<? extends ENTITY> tp) {
|
||||
return doSelectEntity(xprepareCBAsPK(id), tp);
|
||||
}
|
||||
|
||||
protected SuggestElevateWordToLabelCB xprepareCBAsPK(String id) {
|
||||
assertObjectNotNull("id", id);
|
||||
return newConditionBean().acceptPK(id);
|
||||
}
|
||||
|
||||
protected <ENTITY extends SuggestElevateWordToLabel> OptionalEntity<ENTITY> doSelectOptionalByPK(String id, Class<? extends ENTITY> tp) {
|
||||
return createOptionalEntity(doSelectByPK(id, tp), id);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends SuggestElevateWordToLabel> typeOfSelectedEntity() {
|
||||
return SuggestElevateWordToLabel.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<SuggestElevateWordToLabel> typeOfHandlingEntity() {
|
||||
return SuggestElevateWordToLabel.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<SuggestElevateWordToLabelCB> typeOfHandlingConditionBean() {
|
||||
return SuggestElevateWordToLabelCB.class;
|
||||
}
|
||||
|
||||
public ListResultBean<SuggestElevateWordToLabel> selectList(CBCall<SuggestElevateWordToLabelCB> cbLambda) {
|
||||
return facadeSelectList(createCB(cbLambda));
|
||||
}
|
||||
|
||||
public PagingResultBean<SuggestElevateWordToLabel> selectPage(CBCall<SuggestElevateWordToLabelCB> cbLambda) {
|
||||
// #pending same?
|
||||
return (PagingResultBean<SuggestElevateWordToLabel>) facadeSelectList(createCB(cbLambda));
|
||||
}
|
||||
|
||||
public void selectCursor(CBCall<SuggestElevateWordToLabelCB> cbLambda, EntityRowHandler<SuggestElevateWordToLabel> entityLambda) {
|
||||
facadeSelectCursor(createCB(cbLambda), entityLambda);
|
||||
}
|
||||
|
||||
public void selectBulk(CBCall<SuggestElevateWordToLabelCB> cbLambda, EntityRowHandler<List<SuggestElevateWordToLabel>> entityLambda) {
|
||||
delegateSelectBulk(createCB(cbLambda), entityLambda, typeOfSelectedEntity());
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Update
|
||||
// ======
|
||||
public void insert(SuggestElevateWordToLabel entity) {
|
||||
doInsert(entity, null);
|
||||
}
|
||||
|
||||
public void insert(SuggestElevateWordToLabel entity, RequestOptionCall<IndexRequestBuilder> opLambda) {
|
||||
if (entity instanceof EsAbstractEntity) {
|
||||
entity.asDocMeta().indexOption(opLambda);
|
||||
}
|
||||
doInsert(entity, null);
|
||||
}
|
||||
|
||||
public void update(SuggestElevateWordToLabel entity) {
|
||||
doUpdate(entity, null);
|
||||
}
|
||||
|
||||
public void update(SuggestElevateWordToLabel entity, RequestOptionCall<IndexRequestBuilder> opLambda) {
|
||||
if (entity instanceof EsAbstractEntity) {
|
||||
entity.asDocMeta().indexOption(opLambda);
|
||||
}
|
||||
doUpdate(entity, null);
|
||||
}
|
||||
|
||||
public void insertOrUpdate(SuggestElevateWordToLabel entity) {
|
||||
doInsertOrUpdate(entity, null, null);
|
||||
}
|
||||
|
||||
public void insertOrUpdate(SuggestElevateWordToLabel entity, RequestOptionCall<IndexRequestBuilder> opLambda) {
|
||||
if (entity instanceof EsAbstractEntity) {
|
||||
entity.asDocMeta().indexOption(opLambda);
|
||||
}
|
||||
doInsertOrUpdate(entity, null, null);
|
||||
}
|
||||
|
||||
public void delete(SuggestElevateWordToLabel entity) {
|
||||
doDelete(entity, null);
|
||||
}
|
||||
|
||||
public void delete(SuggestElevateWordToLabel entity, RequestOptionCall<DeleteRequestBuilder> opLambda) {
|
||||
if (entity instanceof EsAbstractEntity) {
|
||||
entity.asDocMeta().deleteOption(opLambda);
|
||||
}
|
||||
doDelete(entity, null);
|
||||
}
|
||||
|
||||
public int queryDelete(CBCall<SuggestElevateWordToLabelCB> cbLambda) {
|
||||
return doQueryDelete(createCB(cbLambda), null);
|
||||
}
|
||||
|
||||
public int[] batchInsert(List<SuggestElevateWordToLabel> list) {
|
||||
return batchInsert(list, null);
|
||||
}
|
||||
|
||||
public int[] batchInsert(List<SuggestElevateWordToLabel> list, RequestOptionCall<BulkRequestBuilder> call) {
|
||||
return doBatchInsert(new BulkList<>(list, call), null);
|
||||
}
|
||||
|
||||
public int[] batchUpdate(List<SuggestElevateWordToLabel> list) {
|
||||
return batchUpdate(list, null);
|
||||
}
|
||||
|
||||
public int[] batchUpdate(List<SuggestElevateWordToLabel> list, RequestOptionCall<BulkRequestBuilder> call) {
|
||||
return doBatchUpdate(new BulkList<>(list, call), null);
|
||||
}
|
||||
|
||||
public int[] batchDelete(List<SuggestElevateWordToLabel> list) {
|
||||
return batchDelete(list, null);
|
||||
}
|
||||
|
||||
public int[] batchDelete(List<SuggestElevateWordToLabel> list, RequestOptionCall<BulkRequestBuilder> call) {
|
||||
return doBatchDelete(new BulkList<>(list, call), null);
|
||||
}
|
||||
|
||||
// #pending create, modify, remove
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright 2012-2015 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.es.config.bsentity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.codelibs.fess.es.config.allcommon.EsAbstractEntity;
|
||||
import org.codelibs.fess.es.config.bsentity.dbmeta.SuggestElevateWordToLabelDbm;
|
||||
|
||||
/**
|
||||
* ${table.comment}
|
||||
* @author ESFlute (using FreeGen)
|
||||
*/
|
||||
public class BsSuggestElevateWordToLabel extends EsAbstractEntity {
|
||||
|
||||
// ===================================================================================
|
||||
// Definition
|
||||
// ==========
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected static final Class<?> suppressUnusedImportLocalDateTime = LocalDateTime.class;
|
||||
|
||||
// ===================================================================================
|
||||
// Attribute
|
||||
// =========
|
||||
/** suggestElevateWordId */
|
||||
protected String suggestElevateWordId;
|
||||
|
||||
/** labelTypeId */
|
||||
protected String labelTypeId;
|
||||
|
||||
// [Referrers] *comment only
|
||||
|
||||
// ===================================================================================
|
||||
// DB Meta
|
||||
// =======
|
||||
@Override
|
||||
public SuggestElevateWordToLabelDbm asDBMeta() {
|
||||
return SuggestElevateWordToLabelDbm.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String asTableDbName() {
|
||||
return "suggest_elevate_word_to_label";
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Source
|
||||
// ======
|
||||
@Override
|
||||
public Map<String, Object> toSource() {
|
||||
Map<String, Object> sourceMap = new HashMap<>();
|
||||
if (suggestElevateWordId != null) {
|
||||
sourceMap.put("suggestElevateWordId", suggestElevateWordId);
|
||||
}
|
||||
if (labelTypeId != null) {
|
||||
sourceMap.put("labelTypeId", labelTypeId);
|
||||
}
|
||||
return sourceMap;
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Basic Override
|
||||
// ==============
|
||||
@Override
|
||||
protected String doBuildColumnString(String dm) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(dm).append(suggestElevateWordId);
|
||||
sb.append(dm).append(labelTypeId);
|
||||
if (sb.length() > dm.length()) {
|
||||
sb.delete(0, dm.length());
|
||||
}
|
||||
sb.insert(0, "{").append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Accessor
|
||||
// ========
|
||||
public String getSuggestElevateWordId() {
|
||||
checkSpecifiedProperty("suggestElevateWordId");
|
||||
return convertEmptyToNull(suggestElevateWordId);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId(String value) {
|
||||
registerModifiedProperty("suggestElevateWordId");
|
||||
this.suggestElevateWordId = value;
|
||||
}
|
||||
|
||||
public String getLabelTypeId() {
|
||||
checkSpecifiedProperty("labelTypeId");
|
||||
return convertEmptyToNull(labelTypeId);
|
||||
}
|
||||
|
||||
public void setLabelTypeId(String value) {
|
||||
registerModifiedProperty("labelTypeId");
|
||||
this.labelTypeId = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
/*
|
||||
* Copyright 2012-2015 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.es.config.bsentity.dbmeta;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.codelibs.fess.es.config.exentity.SuggestElevateWordToLabel;
|
||||
import org.dbflute.Entity;
|
||||
import org.dbflute.dbmeta.AbstractDBMeta;
|
||||
import org.dbflute.dbmeta.info.ColumnInfo;
|
||||
import org.dbflute.dbmeta.info.UniqueInfo;
|
||||
import org.dbflute.dbmeta.name.TableSqlName;
|
||||
import org.dbflute.dbmeta.property.PropertyGateway;
|
||||
import org.dbflute.dbway.DBDef;
|
||||
import org.dbflute.util.DfTypeUtil;
|
||||
|
||||
/**
|
||||
* @author ESFlute (using FreeGen)
|
||||
*/
|
||||
public class SuggestElevateWordToLabelDbm extends AbstractDBMeta {
|
||||
|
||||
protected static final Class<?> suppressUnusedImportLocalDateTime = LocalDateTime.class;
|
||||
|
||||
// ===================================================================================
|
||||
// Singleton
|
||||
// =========
|
||||
private static final SuggestElevateWordToLabelDbm _instance = new SuggestElevateWordToLabelDbm();
|
||||
|
||||
private SuggestElevateWordToLabelDbm() {
|
||||
}
|
||||
|
||||
public static SuggestElevateWordToLabelDbm getInstance() {
|
||||
return _instance;
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Current DBDef
|
||||
// =============
|
||||
@Override
|
||||
public String getProjectName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProjectPrefix() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGenerationGapBasePrefix() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DBDef getCurrentDBDef() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Property Gateway
|
||||
// ================
|
||||
// -----------------------------------------------------
|
||||
// Column Property
|
||||
// ---------------
|
||||
protected final Map<String, PropertyGateway> _epgMap = newHashMap();
|
||||
{
|
||||
setupEpg(_epgMap, et -> ((SuggestElevateWordToLabel) et).getSuggestElevateWordId(),
|
||||
(et, vl) -> ((SuggestElevateWordToLabel) et).setSuggestElevateWordId(DfTypeUtil.toString(vl)), "suggestElevateWordId");
|
||||
setupEpg(_epgMap, et -> ((SuggestElevateWordToLabel) et).getLabelTypeId(),
|
||||
(et, vl) -> ((SuggestElevateWordToLabel) et).setLabelTypeId(DfTypeUtil.toString(vl)), "labelTypeId");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyGateway findPropertyGateway(final String prop) {
|
||||
return doFindEpg(_epgMap, prop);
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Table Info
|
||||
// ==========
|
||||
protected final String _tableDbName = "suggest_elevate_word_to_label";
|
||||
protected final String _tableDispName = "suggest_elevate_word_to_label";
|
||||
protected final String _tablePropertyName = "SuggestElevateWordToLabel";
|
||||
|
||||
public String getTableDbName() {
|
||||
return _tableDbName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableDispName() {
|
||||
return _tableDispName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTablePropertyName() {
|
||||
return _tablePropertyName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableSqlName getTableSqlName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Column Info
|
||||
// ===========
|
||||
protected final ColumnInfo _columnSuggestElevateWordId = cci("suggestElevateWordId", "suggestElevateWordId", null, null, String.class,
|
||||
"suggestElevateWordId", null, false, false, false, "String", 0, 0, null, false, null, null, null, null, null, false);
|
||||
protected final ColumnInfo _columnLabelTypeId = cci("labelTypeId", "labelTypeId", null, null, String.class, "labelTypeId", null, false,
|
||||
false, false, "String", 0, 0, null, false, null, null, null, null, null, false);
|
||||
|
||||
public ColumnInfo columnSuggestElevateWordId() {
|
||||
return _columnSuggestElevateWordId;
|
||||
}
|
||||
|
||||
public ColumnInfo columnLabelTypeId() {
|
||||
return _columnLabelTypeId;
|
||||
}
|
||||
|
||||
protected List<ColumnInfo> ccil() {
|
||||
List<ColumnInfo> ls = newArrayList();
|
||||
ls.add(columnSuggestElevateWordId());
|
||||
ls.add(columnLabelTypeId());
|
||||
return ls;
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Unique Info
|
||||
// ===========
|
||||
@Override
|
||||
public boolean hasPrimaryKey() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCompoundPrimaryKey() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UniqueInfo cpui() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Type Name
|
||||
// =========
|
||||
@Override
|
||||
public String getEntityTypeName() {
|
||||
return "org.codelibs.fess.es.config.exentity.SuggestElevateWordToLabel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConditionBeanTypeName() {
|
||||
return "org.codelibs.fess.es.config.cbean.SuggestElevateWordToLabelCB";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBehaviorTypeName() {
|
||||
return "org.codelibs.fess.es.config.exbhv.SuggestElevateWordToLabelBhv";
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Object Type
|
||||
// ===========
|
||||
@Override
|
||||
public Class<? extends Entity> getEntityType() {
|
||||
return SuggestElevateWordToLabel.class;
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Object Instance
|
||||
// ===============
|
||||
@Override
|
||||
public Entity newEntity() {
|
||||
return new SuggestElevateWordToLabel();
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Map Communication
|
||||
// =================
|
||||
@Override
|
||||
public void acceptPrimaryKeyMap(Entity entity, Map<String, ? extends Object> primaryKeyMap) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptAllColumnMap(Entity entity, Map<String, ? extends Object> allColumnMap) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> extractPrimaryKeyMap(Entity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> extractAllColumnMap(Entity entity) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright 2012-2015 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.es.config.cbean;
|
||||
|
||||
import org.codelibs.fess.es.config.cbean.bs.BsSuggestElevateWordToLabelCB;
|
||||
|
||||
/**
|
||||
* @author ESFlute (using FreeGen)
|
||||
*/
|
||||
public class SuggestElevateWordToLabelCB extends BsSuggestElevateWordToLabelCB {
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* Copyright 2012-2015 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.es.config.cbean.bs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.codelibs.fess.es.config.allcommon.EsAbstractConditionBean;
|
||||
import org.codelibs.fess.es.config.bsentity.dbmeta.SuggestElevateWordToLabelDbm;
|
||||
import org.codelibs.fess.es.config.cbean.SuggestElevateWordToLabelCB;
|
||||
import org.codelibs.fess.es.config.cbean.cq.SuggestElevateWordToLabelCQ;
|
||||
import org.codelibs.fess.es.config.cbean.cq.bs.BsSuggestElevateWordToLabelCQ;
|
||||
import org.dbflute.cbean.ConditionQuery;
|
||||
import org.elasticsearch.action.count.CountRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
|
||||
/**
|
||||
* @author ESFlute (using FreeGen)
|
||||
*/
|
||||
public class BsSuggestElevateWordToLabelCB extends EsAbstractConditionBean {
|
||||
|
||||
// ===================================================================================
|
||||
// Attribute
|
||||
// =========
|
||||
protected BsSuggestElevateWordToLabelCQ _conditionQuery;
|
||||
protected HpSpecification _specification;
|
||||
|
||||
// ===================================================================================
|
||||
// Control
|
||||
// =======
|
||||
@Override
|
||||
public SuggestElevateWordToLabelDbm asDBMeta() {
|
||||
return SuggestElevateWordToLabelDbm.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String asTableDbName() {
|
||||
return "suggest_elevate_word_to_label";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSpecifiedColumn() {
|
||||
return _specification != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConditionQuery localCQ() {
|
||||
return doGetConditionQuery();
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Primary Key
|
||||
// ===========
|
||||
public SuggestElevateWordToLabelCB acceptPK(String id) {
|
||||
assertObjectNotNull("id", id);
|
||||
BsSuggestElevateWordToLabelCB cb = this;
|
||||
cb.query().docMeta().setId_Equal(id);
|
||||
return (SuggestElevateWordToLabelCB) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptPrimaryKeyMap(Map<String, ? extends Object> primaryKeyMap) {
|
||||
acceptPK((String) primaryKeyMap.get("_id"));
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Build
|
||||
// =====
|
||||
@Override
|
||||
public CountRequestBuilder build(CountRequestBuilder builder) {
|
||||
if (_conditionQuery != null) {
|
||||
QueryBuilder queryBuilder = _conditionQuery.getQuery();
|
||||
if (queryBuilder != null) {
|
||||
builder.setQuery(queryBuilder);
|
||||
}
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchRequestBuilder build(SearchRequestBuilder builder) {
|
||||
if (_conditionQuery != null) {
|
||||
QueryBuilder queryBuilder = _conditionQuery.getQuery();
|
||||
if (queryBuilder != null) {
|
||||
builder.setQuery(queryBuilder);
|
||||
}
|
||||
_conditionQuery.getFieldSortBuilderList().forEach(sort -> {
|
||||
builder.addSort(sort);
|
||||
});
|
||||
}
|
||||
|
||||
if (_specification != null) {
|
||||
builder.setFetchSource(_specification.columnList.toArray(new String[_specification.columnList.size()]), null);
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Query
|
||||
// =====
|
||||
public BsSuggestElevateWordToLabelCQ query() {
|
||||
assertQueryPurpose();
|
||||
return doGetConditionQuery();
|
||||
}
|
||||
|
||||
protected BsSuggestElevateWordToLabelCQ doGetConditionQuery() {
|
||||
if (_conditionQuery == null) {
|
||||
_conditionQuery = createLocalCQ();
|
||||
}
|
||||
return _conditionQuery;
|
||||
}
|
||||
|
||||
protected BsSuggestElevateWordToLabelCQ createLocalCQ() {
|
||||
return new SuggestElevateWordToLabelCQ();
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Specify
|
||||
// =======
|
||||
public HpSpecification specify() {
|
||||
assertSpecifyPurpose();
|
||||
if (_specification == null) {
|
||||
_specification = new HpSpecification();
|
||||
}
|
||||
return _specification;
|
||||
}
|
||||
|
||||
protected void assertQueryPurpose() {
|
||||
}
|
||||
|
||||
protected void assertSpecifyPurpose() {
|
||||
}
|
||||
|
||||
public static class HpSpecification {
|
||||
private List<String> columnList = new ArrayList<>();
|
||||
|
||||
private void doColumn(String name) {
|
||||
columnList.add(name);
|
||||
}
|
||||
|
||||
public void columnId() {
|
||||
doColumn("_id");
|
||||
}
|
||||
|
||||
public void columnSuggestElevateWordId() {
|
||||
doColumn("suggestElevateWordId");
|
||||
}
|
||||
|
||||
public void columnLabelTypeId() {
|
||||
doColumn("labelTypeId");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright 2012-2015 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.es.config.cbean.cq;
|
||||
|
||||
import org.codelibs.fess.es.config.cbean.cq.bs.BsSuggestElevateWordToLabelCQ;
|
||||
|
||||
/**
|
||||
* @author ESFlute (using FreeGen)
|
||||
*/
|
||||
public class SuggestElevateWordToLabelCQ extends BsSuggestElevateWordToLabelCQ {
|
||||
}
|
|
@ -0,0 +1,511 @@
|
|||
/*
|
||||
* Copyright 2012-2015 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.es.config.cbean.cq.bs;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.codelibs.fess.es.config.allcommon.EsAbstractConditionQuery;
|
||||
import org.codelibs.fess.es.config.cbean.cq.SuggestElevateWordToLabelCQ;
|
||||
import org.dbflute.cbean.ckey.ConditionKey;
|
||||
import org.dbflute.exception.IllegalConditionBeanOperationException;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.FuzzyQueryBuilder;
|
||||
import org.elasticsearch.index.query.IdsQueryBuilder;
|
||||
import org.elasticsearch.index.query.MatchQueryBuilder;
|
||||
import org.elasticsearch.index.query.NotQueryBuilder;
|
||||
import org.elasticsearch.index.query.PrefixQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.query.RangeQueryBuilder;
|
||||
import org.elasticsearch.index.query.TermQueryBuilder;
|
||||
import org.elasticsearch.index.query.TermsQueryBuilder;
|
||||
|
||||
/**
|
||||
* @author ESFlute (using FreeGen)
|
||||
*/
|
||||
public abstract class BsSuggestElevateWordToLabelCQ extends EsAbstractConditionQuery {
|
||||
|
||||
protected static final Class<?> suppressUnusedImportLocalDateTime = LocalDateTime.class;
|
||||
|
||||
// ===================================================================================
|
||||
// Name Override
|
||||
// =============
|
||||
@Override
|
||||
public String asTableDbName() {
|
||||
return "suggest_elevate_word_to_label";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String xgetAliasName() {
|
||||
return "suggest_elevate_word_to_label";
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Query Control
|
||||
// =============
|
||||
public void filtered(FilteredCall<SuggestElevateWordToLabelCQ, SuggestElevateWordToLabelCQ> filteredLambda) {
|
||||
filtered(filteredLambda, null);
|
||||
}
|
||||
|
||||
public void filtered(FilteredCall<SuggestElevateWordToLabelCQ, SuggestElevateWordToLabelCQ> filteredLambda,
|
||||
ConditionOptionCall<BoolQueryBuilder> opLambda) {
|
||||
bool((must, should, mustNot, filter) -> {
|
||||
filteredLambda.callback(must, filter);
|
||||
}, opLambda);
|
||||
}
|
||||
|
||||
public void not(OperatorCall<SuggestElevateWordToLabelCQ> notLambda) {
|
||||
not(notLambda, null);
|
||||
}
|
||||
|
||||
public void not(OperatorCall<SuggestElevateWordToLabelCQ> notLambda, ConditionOptionCall<NotQueryBuilder> opLambda) {
|
||||
SuggestElevateWordToLabelCQ notQuery = new SuggestElevateWordToLabelCQ();
|
||||
notLambda.callback(notQuery);
|
||||
if (notQuery.hasQueries()) {
|
||||
if (notQuery.getQueryBuilderList().size() > 1) {
|
||||
final String msg = "not query must be one query.";
|
||||
throw new IllegalConditionBeanOperationException(msg);
|
||||
}
|
||||
NotQueryBuilder builder = QueryBuilders.notQuery(notQuery.getQueryBuilderList().get(0));
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void bool(BoolCall<SuggestElevateWordToLabelCQ> boolLambda) {
|
||||
bool(boolLambda, null);
|
||||
}
|
||||
|
||||
public void bool(BoolCall<SuggestElevateWordToLabelCQ> boolLambda, ConditionOptionCall<BoolQueryBuilder> opLambda) {
|
||||
SuggestElevateWordToLabelCQ mustQuery = new SuggestElevateWordToLabelCQ();
|
||||
SuggestElevateWordToLabelCQ shouldQuery = new SuggestElevateWordToLabelCQ();
|
||||
SuggestElevateWordToLabelCQ mustNotQuery = new SuggestElevateWordToLabelCQ();
|
||||
SuggestElevateWordToLabelCQ filterQuery = new SuggestElevateWordToLabelCQ();
|
||||
boolLambda.callback(mustQuery, shouldQuery, mustNotQuery, filterQuery);
|
||||
if (mustQuery.hasQueries() || shouldQuery.hasQueries() || mustNotQuery.hasQueries() || filterQuery.hasQueries()) {
|
||||
BoolQueryBuilder builder =
|
||||
regBoolCQ(mustQuery.getQueryBuilderList(), shouldQuery.getQueryBuilderList(), mustNotQuery.getQueryBuilderList(),
|
||||
filterQuery.getQueryBuilderList());
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Query Set
|
||||
// =========
|
||||
public void setId_Equal(String id) {
|
||||
setId_Term(id, null);
|
||||
}
|
||||
|
||||
public void setId_Equal(String id, ConditionOptionCall<TermQueryBuilder> opLambda) {
|
||||
setId_Term(id, opLambda);
|
||||
}
|
||||
|
||||
public void setId_Term(String id) {
|
||||
setId_Term(id, null);
|
||||
}
|
||||
|
||||
public void setId_Term(String id, ConditionOptionCall<TermQueryBuilder> opLambda) {
|
||||
TermQueryBuilder builder = regTermQ("_id", id);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setId_NotEqual(String id) {
|
||||
setId_NotTerm(id, null);
|
||||
}
|
||||
|
||||
public void setId_NotEqual(String id, ConditionOptionCall<NotQueryBuilder> opLambda) {
|
||||
setId_NotTerm(id, opLambda);
|
||||
}
|
||||
|
||||
public void setId_NotTerm(String id) {
|
||||
setId_NotTerm(id, null);
|
||||
}
|
||||
|
||||
public void setId_NotTerm(String id, ConditionOptionCall<NotQueryBuilder> opLambda) {
|
||||
NotQueryBuilder builder = QueryBuilders.notQuery(regTermQ("_id", id));
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setId_Terms(Collection<String> idList) {
|
||||
setId_Terms(idList, null);
|
||||
}
|
||||
|
||||
public void setId_Terms(Collection<String> idList, ConditionOptionCall<IdsQueryBuilder> opLambda) {
|
||||
IdsQueryBuilder builder = regIdsQ(idList);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setId_InScope(Collection<String> idList) {
|
||||
setId_Terms(idList, null);
|
||||
}
|
||||
|
||||
public void setId_InScope(Collection<String> idList, ConditionOptionCall<IdsQueryBuilder> opLambda) {
|
||||
setId_Terms(idList, opLambda);
|
||||
}
|
||||
|
||||
public BsSuggestElevateWordToLabelCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsSuggestElevateWordToLabelCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_Equal(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_Term(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_Equal(String suggestElevateWordId, ConditionOptionCall<TermQueryBuilder> opLambda) {
|
||||
setSuggestElevateWordId_Term(suggestElevateWordId, opLambda);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_Term(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_Term(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_Term(String suggestElevateWordId, ConditionOptionCall<TermQueryBuilder> opLambda) {
|
||||
TermQueryBuilder builder = regTermQ("suggestElevateWordId", suggestElevateWordId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_NotEqual(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_NotTerm(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_NotEqual(String suggestElevateWordId, ConditionOptionCall<NotQueryBuilder> opLambda) {
|
||||
setSuggestElevateWordId_NotTerm(suggestElevateWordId, opLambda);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_NotTerm(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_NotTerm(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_NotTerm(String suggestElevateWordId, ConditionOptionCall<NotQueryBuilder> opLambda) {
|
||||
NotQueryBuilder builder = QueryBuilders.notQuery(regTermQ("suggestElevateWordId", suggestElevateWordId));
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_Terms(Collection<String> suggestElevateWordIdList) {
|
||||
setSuggestElevateWordId_Terms(suggestElevateWordIdList, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_Terms(Collection<String> suggestElevateWordIdList, ConditionOptionCall<TermsQueryBuilder> opLambda) {
|
||||
TermsQueryBuilder builder = regTermsQ("suggestElevateWordId", suggestElevateWordIdList);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_InScope(Collection<String> suggestElevateWordIdList) {
|
||||
setSuggestElevateWordId_Terms(suggestElevateWordIdList, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_InScope(Collection<String> suggestElevateWordIdList, ConditionOptionCall<TermsQueryBuilder> opLambda) {
|
||||
setSuggestElevateWordId_Terms(suggestElevateWordIdList, opLambda);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_Match(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_Match(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_Match(String suggestElevateWordId, ConditionOptionCall<MatchQueryBuilder> opLambda) {
|
||||
MatchQueryBuilder builder = regMatchQ("suggestElevateWordId", suggestElevateWordId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_MatchPhrase(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_MatchPhrase(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_MatchPhrase(String suggestElevateWordId, ConditionOptionCall<MatchQueryBuilder> opLambda) {
|
||||
MatchQueryBuilder builder = regMatchPhraseQ("suggestElevateWordId", suggestElevateWordId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_MatchPhrasePrefix(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_MatchPhrasePrefix(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_MatchPhrasePrefix(String suggestElevateWordId, ConditionOptionCall<MatchQueryBuilder> opLambda) {
|
||||
MatchQueryBuilder builder = regMatchPhrasePrefixQ("suggestElevateWordId", suggestElevateWordId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_Fuzzy(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_Fuzzy(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_Fuzzy(String suggestElevateWordId, ConditionOptionCall<FuzzyQueryBuilder> opLambda) {
|
||||
FuzzyQueryBuilder builder = regFuzzyQ("suggestElevateWordId", suggestElevateWordId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_Prefix(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_Prefix(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_Prefix(String suggestElevateWordId, ConditionOptionCall<PrefixQueryBuilder> opLambda) {
|
||||
PrefixQueryBuilder builder = regPrefixQ("suggestElevateWordId", suggestElevateWordId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_GreaterThan(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_GreaterThan(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_GreaterThan(String suggestElevateWordId, ConditionOptionCall<RangeQueryBuilder> opLambda) {
|
||||
RangeQueryBuilder builder = regRangeQ("suggestElevateWordId", ConditionKey.CK_GREATER_THAN, suggestElevateWordId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_LessThan(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_LessThan(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_LessThan(String suggestElevateWordId, ConditionOptionCall<RangeQueryBuilder> opLambda) {
|
||||
RangeQueryBuilder builder = regRangeQ("suggestElevateWordId", ConditionKey.CK_LESS_THAN, suggestElevateWordId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_GreaterEqual(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_GreaterEqual(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_GreaterEqual(String suggestElevateWordId, ConditionOptionCall<RangeQueryBuilder> opLambda) {
|
||||
RangeQueryBuilder builder = regRangeQ("suggestElevateWordId", ConditionKey.CK_GREATER_EQUAL, suggestElevateWordId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_LessEqual(String suggestElevateWordId) {
|
||||
setSuggestElevateWordId_LessEqual(suggestElevateWordId, null);
|
||||
}
|
||||
|
||||
public void setSuggestElevateWordId_LessEqual(String suggestElevateWordId, ConditionOptionCall<RangeQueryBuilder> opLambda) {
|
||||
RangeQueryBuilder builder = regRangeQ("suggestElevateWordId", ConditionKey.CK_LESS_EQUAL, suggestElevateWordId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public BsSuggestElevateWordToLabelCQ addOrderBy_SuggestElevateWordId_Asc() {
|
||||
regOBA("suggestElevateWordId");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsSuggestElevateWordToLabelCQ addOrderBy_SuggestElevateWordId_Desc() {
|
||||
regOBD("suggestElevateWordId");
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setLabelTypeId_Equal(String labelTypeId) {
|
||||
setLabelTypeId_Term(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_Equal(String labelTypeId, ConditionOptionCall<TermQueryBuilder> opLambda) {
|
||||
setLabelTypeId_Term(labelTypeId, opLambda);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_Term(String labelTypeId) {
|
||||
setLabelTypeId_Term(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_Term(String labelTypeId, ConditionOptionCall<TermQueryBuilder> opLambda) {
|
||||
TermQueryBuilder builder = regTermQ("labelTypeId", labelTypeId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabelTypeId_NotEqual(String labelTypeId) {
|
||||
setLabelTypeId_NotTerm(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_NotEqual(String labelTypeId, ConditionOptionCall<NotQueryBuilder> opLambda) {
|
||||
setLabelTypeId_NotTerm(labelTypeId, opLambda);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_NotTerm(String labelTypeId) {
|
||||
setLabelTypeId_NotTerm(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_NotTerm(String labelTypeId, ConditionOptionCall<NotQueryBuilder> opLambda) {
|
||||
NotQueryBuilder builder = QueryBuilders.notQuery(regTermQ("labelTypeId", labelTypeId));
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabelTypeId_Terms(Collection<String> labelTypeIdList) {
|
||||
setLabelTypeId_Terms(labelTypeIdList, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_Terms(Collection<String> labelTypeIdList, ConditionOptionCall<TermsQueryBuilder> opLambda) {
|
||||
TermsQueryBuilder builder = regTermsQ("labelTypeId", labelTypeIdList);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabelTypeId_InScope(Collection<String> labelTypeIdList) {
|
||||
setLabelTypeId_Terms(labelTypeIdList, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_InScope(Collection<String> labelTypeIdList, ConditionOptionCall<TermsQueryBuilder> opLambda) {
|
||||
setLabelTypeId_Terms(labelTypeIdList, opLambda);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_Match(String labelTypeId) {
|
||||
setLabelTypeId_Match(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_Match(String labelTypeId, ConditionOptionCall<MatchQueryBuilder> opLambda) {
|
||||
MatchQueryBuilder builder = regMatchQ("labelTypeId", labelTypeId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabelTypeId_MatchPhrase(String labelTypeId) {
|
||||
setLabelTypeId_MatchPhrase(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_MatchPhrase(String labelTypeId, ConditionOptionCall<MatchQueryBuilder> opLambda) {
|
||||
MatchQueryBuilder builder = regMatchPhraseQ("labelTypeId", labelTypeId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabelTypeId_MatchPhrasePrefix(String labelTypeId) {
|
||||
setLabelTypeId_MatchPhrasePrefix(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_MatchPhrasePrefix(String labelTypeId, ConditionOptionCall<MatchQueryBuilder> opLambda) {
|
||||
MatchQueryBuilder builder = regMatchPhrasePrefixQ("labelTypeId", labelTypeId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabelTypeId_Fuzzy(String labelTypeId) {
|
||||
setLabelTypeId_Fuzzy(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_Fuzzy(String labelTypeId, ConditionOptionCall<FuzzyQueryBuilder> opLambda) {
|
||||
FuzzyQueryBuilder builder = regFuzzyQ("labelTypeId", labelTypeId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabelTypeId_Prefix(String labelTypeId) {
|
||||
setLabelTypeId_Prefix(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_Prefix(String labelTypeId, ConditionOptionCall<PrefixQueryBuilder> opLambda) {
|
||||
PrefixQueryBuilder builder = regPrefixQ("labelTypeId", labelTypeId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabelTypeId_GreaterThan(String labelTypeId) {
|
||||
setLabelTypeId_GreaterThan(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_GreaterThan(String labelTypeId, ConditionOptionCall<RangeQueryBuilder> opLambda) {
|
||||
RangeQueryBuilder builder = regRangeQ("labelTypeId", ConditionKey.CK_GREATER_THAN, labelTypeId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabelTypeId_LessThan(String labelTypeId) {
|
||||
setLabelTypeId_LessThan(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_LessThan(String labelTypeId, ConditionOptionCall<RangeQueryBuilder> opLambda) {
|
||||
RangeQueryBuilder builder = regRangeQ("labelTypeId", ConditionKey.CK_LESS_THAN, labelTypeId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabelTypeId_GreaterEqual(String labelTypeId) {
|
||||
setLabelTypeId_GreaterEqual(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_GreaterEqual(String labelTypeId, ConditionOptionCall<RangeQueryBuilder> opLambda) {
|
||||
RangeQueryBuilder builder = regRangeQ("labelTypeId", ConditionKey.CK_GREATER_EQUAL, labelTypeId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabelTypeId_LessEqual(String labelTypeId) {
|
||||
setLabelTypeId_LessEqual(labelTypeId, null);
|
||||
}
|
||||
|
||||
public void setLabelTypeId_LessEqual(String labelTypeId, ConditionOptionCall<RangeQueryBuilder> opLambda) {
|
||||
RangeQueryBuilder builder = regRangeQ("labelTypeId", ConditionKey.CK_LESS_EQUAL, labelTypeId);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public BsSuggestElevateWordToLabelCQ addOrderBy_LabelTypeId_Asc() {
|
||||
regOBA("labelTypeId");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsSuggestElevateWordToLabelCQ addOrderBy_LabelTypeId_Desc() {
|
||||
regOBD("labelTypeId");
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright 2012-2015 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.es.config.exbhv;
|
||||
|
||||
import org.codelibs.fess.es.config.bsbhv.BsSuggestElevateWordToLabelBhv;
|
||||
|
||||
/**
|
||||
* @author FreeGen
|
||||
*/
|
||||
public class SuggestElevateWordToLabelBhv extends BsSuggestElevateWordToLabelBhv {
|
||||
|
||||
}
|
|
@ -15,7 +15,16 @@
|
|||
*/
|
||||
package org.codelibs.fess.es.config.exentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
import org.codelibs.fess.es.config.bsentity.BsSuggestElevateWord;
|
||||
import org.codelibs.fess.es.config.exbhv.LabelTypeBhv;
|
||||
import org.codelibs.fess.es.config.exbhv.WebConfigToLabelBhv;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
import org.dbflute.cbean.result.ListResultBean;
|
||||
|
||||
/**
|
||||
* @author FreeGen
|
||||
|
@ -24,6 +33,57 @@ public class SuggestElevateWord extends BsSuggestElevateWord {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String[] labelTypeIds;
|
||||
|
||||
private List<LabelType> labelTypeList;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.codelibs.fess.db.exentity.CrawlingConfig#getLabelTypeIds()
|
||||
*/
|
||||
public String[] getLabelTypeIds() {
|
||||
if (labelTypeIds == null) {
|
||||
return StringUtil.EMPTY_STRINGS;
|
||||
}
|
||||
return labelTypeIds;
|
||||
}
|
||||
|
||||
public void setLabelTypeIds(final String[] labelTypeIds) {
|
||||
this.labelTypeIds = labelTypeIds;
|
||||
}
|
||||
|
||||
public List<LabelType> getLabelTypeList() {
|
||||
if (labelTypeList == null) {
|
||||
synchronized (this) {
|
||||
if (labelTypeList == null) {
|
||||
final WebConfigToLabelBhv webConfigToLabelBhv = ComponentUtil.getComponent(WebConfigToLabelBhv.class);
|
||||
final ListResultBean<WebConfigToLabel> mappingList = webConfigToLabelBhv.selectList(cb -> {
|
||||
cb.query().setWebConfigId_Equal(getId());
|
||||
cb.specify().columnLabelTypeId();
|
||||
});
|
||||
final List<String> labelIdList = new ArrayList<>();
|
||||
for (final WebConfigToLabel mapping : mappingList) {
|
||||
labelIdList.add(mapping.getLabelTypeId());
|
||||
}
|
||||
final LabelTypeBhv labelTypeBhv = ComponentUtil.getComponent(LabelTypeBhv.class);
|
||||
labelTypeList = labelIdList.isEmpty() ? Collections.emptyList() : labelTypeBhv.selectList(cb -> {
|
||||
cb.query().setId_InScope(labelIdList);
|
||||
cb.query().addOrderBy_SortOrder_Asc();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return labelTypeList;
|
||||
}
|
||||
|
||||
public String[] getLabelTypeValues() {
|
||||
final List<LabelType> list = getLabelTypeList();
|
||||
final List<String> labelValueList = new ArrayList<>(list.size());
|
||||
for (final LabelType labelType : list) {
|
||||
labelValueList.add(labelType.getValue());
|
||||
}
|
||||
return labelValueList.toArray(new String[labelValueList.size()]);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return asDocMeta().id();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright 2012-2015 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.es.config.exentity;
|
||||
|
||||
import org.codelibs.fess.es.config.bsentity.BsSuggestElevateWordToLabel;
|
||||
|
||||
/**
|
||||
* @author FreeGen
|
||||
*/
|
||||
public class SuggestElevateWordToLabel extends BsSuggestElevateWordToLabel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String getId() {
|
||||
return asDocMeta().id();
|
||||
}
|
||||
|
||||
public void setId(final String id) {
|
||||
asDocMeta().id(id);
|
||||
}
|
||||
|
||||
public Long getVersionNo() {
|
||||
return asDocMeta().version();
|
||||
}
|
||||
|
||||
public void setVersionNo(final Long version) {
|
||||
asDocMeta().version(version);
|
||||
}
|
||||
}
|
|
@ -17,7 +17,10 @@ package org.codelibs.fess.helper;
|
|||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
@ -173,7 +176,7 @@ public class SuggestHelper {
|
|||
});
|
||||
|
||||
for (final SuggestElevateWord elevateWord : list) {
|
||||
addElevateWord(elevateWord.getSuggestWord(), elevateWord.getReading(), elevateWord.getTargetLabel(),
|
||||
addElevateWord(elevateWord.getSuggestWord(), elevateWord.getReading(), elevateWord.getLabelTypeValues(),
|
||||
elevateWord.getTargetRole(), elevateWord.getBoost(), false);
|
||||
}
|
||||
suggester.refresh();
|
||||
|
@ -195,18 +198,15 @@ public class SuggestHelper {
|
|||
suggester.refresh();
|
||||
}
|
||||
|
||||
public void addElevateWord(final String word, final String reading, final String tags, final String roles, final float boost) {
|
||||
public void addElevateWord(final String word, final String reading, final String[] tags, final String roles, final float boost) {
|
||||
addElevateWord(word, reading, tags, roles, boost, true);
|
||||
}
|
||||
|
||||
public void addElevateWord(final String word, final String reading, final String tags, final String roles, final float boost,
|
||||
public void addElevateWord(final String word, final String reading, final String[] tags, final String roles, final float boost,
|
||||
final boolean commit) {
|
||||
final List<String> labelList = new ArrayList<String>();
|
||||
if (StringUtil.isNotBlank(tags)) {
|
||||
final String[] array = tags.trim().split(",");
|
||||
for (final String label : array) {
|
||||
labelList.add(label);
|
||||
}
|
||||
for (final String label : tags) {
|
||||
labelList.add(label);
|
||||
}
|
||||
final List<String> roleList = new ArrayList<String>();
|
||||
if (StringUtil.isNotBlank(roles)) {
|
||||
|
|
|
@ -17,14 +17,14 @@ package org.codelibs.fess.helper.impl;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Base64;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Base64;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
|
|
@ -93,6 +93,9 @@
|
|||
<postConstruct name="addIndexConfig">
|
||||
<arg>".fess_config/suggest_elevate_word"</arg>
|
||||
</postConstruct>
|
||||
<postConstruct name="addIndexConfig">
|
||||
<arg>".fess_config/suggest_elevate_word_to_label"</arg>
|
||||
</postConstruct>
|
||||
<postConstruct name="addIndexConfig">
|
||||
<arg>".fess_config/web_authentication"</arg>
|
||||
</postConstruct>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<component name="roleTypeBhv" class="org.codelibs.fess.es.config.exbhv.RoleTypeBhv"/>
|
||||
<component name="scheduledJobBhv" class="org.codelibs.fess.es.config.exbhv.ScheduledJobBhv"/>
|
||||
<component name="suggestBadWordBhv" class="org.codelibs.fess.es.config.exbhv.SuggestBadWordBhv"/>
|
||||
<component name="suggestElevateWordToLabelBhv" class="org.codelibs.fess.es.config.exbhv.SuggestElevateWordToLabelBhv"/>
|
||||
<component name="suggestElevateWordBhv" class="org.codelibs.fess.es.config.exbhv.SuggestElevateWordBhv"/>
|
||||
<component name="webAuthenticationBhv" class="org.codelibs.fess.es.config.exbhv.WebAuthenticationBhv"/>
|
||||
<component name="webConfigToLabelBhv" class="org.codelibs.fess.es.config.exbhv.WebConfigToLabelBhv"/>
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"suggest_elevate_word_to_label": {
|
||||
"_source": {
|
||||
"enabled": true
|
||||
},
|
||||
"_all": {
|
||||
"enabled": false
|
||||
},
|
||||
"properties": {
|
||||
"suggestElevateWordId": {
|
||||
"type": "string",
|
||||
"index": "not_analyzed"
|
||||
},
|
||||
"labelTypeId": {
|
||||
"type": "string",
|
||||
"index": "not_analyzed"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -106,10 +106,21 @@
|
|||
<td>${f:h(targetRole)}<la:hidden property="targetRole" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><la:message
|
||||
key="labels.suggest_elevate_word_target_label" /></th>
|
||||
<td>${f:h(targetLabel)}<la:hidden
|
||||
property="targetLabel" /></td>
|
||||
<th><la:message key="labels.label_type" /></th>
|
||||
<td><c:forEach var="l" varStatus="s"
|
||||
items="${labelTypeItems}">
|
||||
<c:forEach var="ltid" varStatus="s"
|
||||
items="${labelTypeIds}">
|
||||
<c:if test="${ltid==l.id}">
|
||||
${f:h(l.name)}<br />
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:forEach> <la:select property="labelTypeIds" multiple="true"
|
||||
style="display:none;">
|
||||
<c:forEach var="l" varStatus="s" items="${labelTypeItems}">
|
||||
<la:option value="${f:u(l.id)}">${f:h(l.name)}</la:option>
|
||||
</c:forEach>
|
||||
</la:select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><la:message key="labels.suggest_elevate_word_boost" /></th>
|
||||
|
|
|
@ -109,10 +109,15 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="targetLabel" class="col-sm-3 control-label"><la:message
|
||||
key="labels.suggest_elevate_word_target_label" /></label>
|
||||
<label for="labelTypeIds" class="col-sm-3 control-label"><la:message
|
||||
key="labels.label_type" /></label>
|
||||
<div class="col-sm-9">
|
||||
<la:text property="targetLabel" styleClass="form-control" />
|
||||
<la:select property="labelTypeIds" multiple="true"
|
||||
styleClass="form-control">
|
||||
<c:forEach var="l" varStatus="s" items="${labelTypeItems}">
|
||||
<la:option value="${f:u(l.id)}">${f:h(l.name)}</la:option>
|
||||
</c:forEach>
|
||||
</la:select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
Loading…
Add table
Reference in a new issue