fix #1125 add requestAt to field log

fix #1138 add related content

fix #1139 add related query

fix #1140 add virtual host to keymatch
This commit is contained in:
Shinsuke Sugaya 2017-07-06 22:25:12 +09:00
parent 686c199b1b
commit 90a8eed3b3
84 changed files with 11159 additions and 53 deletions

View file

@ -571,6 +571,9 @@
"term" : {
"type": "keyword"
},
"virtualHost" : {
"type": "keyword"
},
"updatedBy" : {
"type": "keyword"
},
@ -863,6 +866,62 @@
"type": "keyword"
}
}
},
"related_content" : {
"_all" : {
"enabled" : false
},
"properties" : {
"createdBy" : {
"type": "keyword"
},
"createdTime" : {
"type" : "long"
},
"updatedBy" : {
"type": "keyword"
},
"updatedTime" : {
"type" : "long"
},
"term" : {
"type": "keyword"
},
"content" : {
"type": "keyword"
},
"virtualHost" : {
"type": "keyword"
}
}
},
"related_query" : {
"_all" : {
"enabled" : false
},
"properties" : {
"createdBy" : {
"type": "keyword"
},
"createdTime" : {
"type" : "long"
},
"updatedBy" : {
"type": "keyword"
},
"updatedTime" : {
"type" : "long"
},
"term" : {
"type": "keyword"
},
"queries" : {
"type": "keyword"
},
"virtualHost" : {
"type": "keyword"
}
}
}
},
"settings" : {
@ -910,6 +969,13 @@
"array" : "true"
}
}
},
"related_query" : {
"properties" : {
"queries" : {
"array" : "true"
}
}
}
},
"number_of_shards" : "2",

View file

@ -14,6 +14,10 @@
},
"value" : {
"type": "keyword"
},
"requestedAt" : {
"type" : "date",
"format" : "date_optional_time"
}
}
},

View file

@ -405,6 +405,8 @@ public class Constants extends CoreLibConstants {
public static final String PERMISSIONS = "permissions";
public static final String QUERIES = "queries";
public static final String CIPHER_PREFIX = "{cipher}";
public static final String SYSTEM_USER = "system";

View file

@ -0,0 +1,142 @@
/*
* Copyright 2012-2017 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.pager;
import java.io.Serializable;
import java.util.List;
import org.codelibs.fess.Constants;
import org.codelibs.fess.util.ComponentUtil;
public class RelatedContentPager implements Serializable {
private static final long serialVersionUID = 1L;
public static final int DEFAULT_CURRENT_PAGE_NUMBER = 1;
private int allRecordCount;
private int allPageCount;
private boolean existPrePage;
private boolean existNextPage;
private List<Integer> pageNumberList;
private int pageSize;
private int currentPageNumber;
public String id;
public String term;
public String queries;
public String createdBy;
public String createdTime;
public String versionNo;
public void clear() {
allRecordCount = 0;
allPageCount = 0;
existPrePage = false;
existNextPage = false;
pageSize = getDefaultPageSize();
currentPageNumber = getDefaultCurrentPageNumber();
id = null;
term = null;
queries = null;
createdBy = null;
createdTime = null;
versionNo = null;
}
public int getAllRecordCount() {
return allRecordCount;
}
public void setAllRecordCount(final int allRecordCount) {
this.allRecordCount = allRecordCount;
}
public int getAllPageCount() {
return allPageCount;
}
public void setAllPageCount(final int allPageCount) {
this.allPageCount = allPageCount;
}
public boolean isExistPrePage() {
return existPrePage;
}
public void setExistPrePage(final boolean existPrePage) {
this.existPrePage = existPrePage;
}
public boolean isExistNextPage() {
return existNextPage;
}
public void setExistNextPage(final boolean existNextPage) {
this.existNextPage = existNextPage;
}
public int getPageSize() {
if (pageSize <= 0) {
pageSize = getDefaultPageSize();
}
return pageSize;
}
public void setPageSize(final int pageSize) {
this.pageSize = pageSize;
}
public int getCurrentPageNumber() {
if (currentPageNumber <= 0) {
currentPageNumber = getDefaultCurrentPageNumber();
}
return currentPageNumber;
}
public void setCurrentPageNumber(final int currentPageNumber) {
this.currentPageNumber = currentPageNumber;
}
public List<Integer> getPageNumberList() {
return pageNumberList;
}
public void setPageNumberList(final List<Integer> pageNumberList) {
this.pageNumberList = pageNumberList;
}
protected int getDefaultCurrentPageNumber() {
return Constants.DEFAULT_ADMIN_PAGE_NUMBER;
}
protected int getDefaultPageSize() {
return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
}
}

View file

@ -0,0 +1,142 @@
/*
* Copyright 2012-2017 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.pager;
import java.io.Serializable;
import java.util.List;
import org.codelibs.fess.Constants;
import org.codelibs.fess.util.ComponentUtil;
public class RelatedQueryPager implements Serializable {
private static final long serialVersionUID = 1L;
public static final int DEFAULT_CURRENT_PAGE_NUMBER = 1;
private int allRecordCount;
private int allPageCount;
private boolean existPrePage;
private boolean existNextPage;
private List<Integer> pageNumberList;
private int pageSize;
private int currentPageNumber;
public String id;
public String term;
public String queries;
public String createdBy;
public String createdTime;
public String versionNo;
public void clear() {
allRecordCount = 0;
allPageCount = 0;
existPrePage = false;
existNextPage = false;
pageSize = getDefaultPageSize();
currentPageNumber = getDefaultCurrentPageNumber();
id = null;
term = null;
queries = null;
createdBy = null;
createdTime = null;
versionNo = null;
}
public int getAllRecordCount() {
return allRecordCount;
}
public void setAllRecordCount(final int allRecordCount) {
this.allRecordCount = allRecordCount;
}
public int getAllPageCount() {
return allPageCount;
}
public void setAllPageCount(final int allPageCount) {
this.allPageCount = allPageCount;
}
public boolean isExistPrePage() {
return existPrePage;
}
public void setExistPrePage(final boolean existPrePage) {
this.existPrePage = existPrePage;
}
public boolean isExistNextPage() {
return existNextPage;
}
public void setExistNextPage(final boolean existNextPage) {
this.existNextPage = existNextPage;
}
public int getPageSize() {
if (pageSize <= 0) {
pageSize = getDefaultPageSize();
}
return pageSize;
}
public void setPageSize(final int pageSize) {
this.pageSize = pageSize;
}
public int getCurrentPageNumber() {
if (currentPageNumber <= 0) {
currentPageNumber = getDefaultCurrentPageNumber();
}
return currentPageNumber;
}
public void setCurrentPageNumber(final int currentPageNumber) {
this.currentPageNumber = currentPageNumber;
}
public List<Integer> getPageNumberList() {
return pageNumberList;
}
public void setPageNumberList(final List<Integer> pageNumberList) {
this.pageNumberList = pageNumberList;
}
protected int getDefaultCurrentPageNumber() {
return Constants.DEFAULT_ADMIN_PAGE_NUMBER;
}
protected int getDefaultPageSize() {
return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
}
}

View file

@ -86,11 +86,4 @@ public class KeyMatchService {
}
public List<KeyMatch> getAvailableKeyMatchList() {
return keyMatchBhv.selectList(cb -> {
cb.query().matchAll();
cb.fetchFirst(fessConfig.getPageKeymatchMaxFetchSizeAsInteger());
});
}
}

View file

@ -0,0 +1,94 @@
/*
* Copyright 2012-2017 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;
import java.util.List;
import javax.annotation.Resource;
import org.codelibs.core.beans.util.BeanUtil;
import org.codelibs.fess.Constants;
import org.codelibs.fess.app.pager.RelatedContentPager;
import org.codelibs.fess.es.config.cbean.RelatedContentCB;
import org.codelibs.fess.es.config.exbhv.RelatedContentBhv;
import org.codelibs.fess.es.config.exentity.RelatedContent;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.codelibs.fess.util.ComponentUtil;
import org.dbflute.cbean.result.PagingResultBean;
import org.dbflute.optional.OptionalEntity;
public class RelatedContentService {
@Resource
protected RelatedContentBhv relatedContentBhv;
@Resource
protected FessConfig fessConfig;
public List<RelatedContent> getRelatedContentList(final RelatedContentPager relatedContentPager) {
final PagingResultBean<RelatedContent> relatedContentList = relatedContentBhv.selectPage(cb -> {
cb.paging(relatedContentPager.getPageSize(), relatedContentPager.getCurrentPageNumber());
setupListCondition(cb, relatedContentPager);
});
// update pager
BeanUtil.copyBeanToBean(relatedContentList, relatedContentPager, option -> option.include(Constants.PAGER_CONVERSION_RULE));
relatedContentPager.setPageNumberList(relatedContentList
.pageRange(op -> op.rangeSize(fessConfig.getPagingPageRangeSizeAsInteger())).createPageNumberList());
return relatedContentList;
}
public OptionalEntity<RelatedContent> getRelatedContent(final String id) {
return relatedContentBhv.selectByPK(id);
}
public void store(final RelatedContent relatedContent) {
relatedContentBhv.insertOrUpdate(relatedContent, op -> op.setRefreshPolicy(Constants.TRUE));
ComponentUtil.getRelatedContentHelper().update();
}
public void delete(final RelatedContent relatedContent) {
relatedContentBhv.delete(relatedContent, op -> op.setRefreshPolicy(Constants.TRUE));
ComponentUtil.getRelatedContentHelper().update();
}
protected void setupListCondition(final RelatedContentCB cb, final RelatedContentPager relatedContentPager) {
if (relatedContentPager.id != null) {
cb.query().docMeta().setId_Equal(relatedContentPager.id);
}
// TODO Long, Integer, String supported only.
// setup condition
cb.query().addOrderBy_Term_Asc();
cb.query().addOrderBy_CreatedTime_Asc();
// search
}
public List<RelatedContent> getAvailableRelatedContentList() {
return relatedContentBhv.selectList(cb -> {
cb.query().matchAll();
cb.query().addOrderBy_Term_Asc();
cb.fetchFirst(fessConfig.getPageDocboostMaxFetchSizeAsInteger());
});
}
}

View file

@ -0,0 +1,86 @@
/*
* Copyright 2012-2017 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;
import java.util.List;
import javax.annotation.Resource;
import org.codelibs.core.beans.util.BeanUtil;
import org.codelibs.fess.Constants;
import org.codelibs.fess.app.pager.RelatedQueryPager;
import org.codelibs.fess.es.config.cbean.RelatedQueryCB;
import org.codelibs.fess.es.config.exbhv.RelatedQueryBhv;
import org.codelibs.fess.es.config.exentity.RelatedQuery;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.codelibs.fess.util.ComponentUtil;
import org.dbflute.cbean.result.PagingResultBean;
import org.dbflute.optional.OptionalEntity;
public class RelatedQueryService {
@Resource
protected RelatedQueryBhv relatedQueryBhv;
@Resource
protected FessConfig fessConfig;
public List<RelatedQuery> getRelatedQueryList(final RelatedQueryPager relatedQueryPager) {
final PagingResultBean<RelatedQuery> relatedQueryList = relatedQueryBhv.selectPage(cb -> {
cb.paging(relatedQueryPager.getPageSize(), relatedQueryPager.getCurrentPageNumber());
setupListCondition(cb, relatedQueryPager);
});
// update pager
BeanUtil.copyBeanToBean(relatedQueryList, relatedQueryPager, option -> option.include(Constants.PAGER_CONVERSION_RULE));
relatedQueryPager.setPageNumberList(relatedQueryList.pageRange(op -> op.rangeSize(fessConfig.getPagingPageRangeSizeAsInteger()))
.createPageNumberList());
return relatedQueryList;
}
public OptionalEntity<RelatedQuery> getRelatedQuery(final String id) {
return relatedQueryBhv.selectByPK(id);
}
public void store(final RelatedQuery relatedQuery) {
relatedQueryBhv.insertOrUpdate(relatedQuery, op -> op.setRefreshPolicy(Constants.TRUE));
ComponentUtil.getRelatedQueryHelper().update();
}
public void delete(final RelatedQuery relatedQuery) {
relatedQueryBhv.delete(relatedQuery, op -> op.setRefreshPolicy(Constants.TRUE));
ComponentUtil.getRelatedQueryHelper().update();
}
protected void setupListCondition(final RelatedQueryCB cb, final RelatedQueryPager relatedQueryPager) {
if (relatedQueryPager.id != null) {
cb.query().docMeta().setId_Equal(relatedQueryPager.id);
}
// TODO Long, Integer, String supported only.
// setup condition
cb.query().addOrderBy_Term_Asc();
cb.query().addOrderBy_CreatedTime_Asc();
// search
}
}

View file

@ -52,6 +52,9 @@ public class CreateForm {
@ValidateTypeFailure
public Float boost;
@Size(max = 1000)
public String virtualHost;
@Size(max = 255)
public String createdBy;

View file

@ -0,0 +1,295 @@
/*
* Copyright 2012-2017 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.web.admin.relatedcontent;
import javax.annotation.Resource;
import org.codelibs.core.beans.util.BeanUtil;
import org.codelibs.fess.Constants;
import org.codelibs.fess.app.pager.RelatedContentPager;
import org.codelibs.fess.app.service.RelatedContentService;
import org.codelibs.fess.app.web.CrudMode;
import org.codelibs.fess.app.web.base.FessAdminAction;
import org.codelibs.fess.es.config.exentity.RelatedContent;
import org.codelibs.fess.helper.SystemHelper;
import org.codelibs.fess.util.ComponentUtil;
import org.codelibs.fess.util.RenderDataUtil;
import org.dbflute.optional.OptionalEntity;
import org.dbflute.optional.OptionalThing;
import org.lastaflute.web.Execute;
import org.lastaflute.web.response.HtmlResponse;
import org.lastaflute.web.response.render.RenderData;
import org.lastaflute.web.ruts.process.ActionRuntime;
/**
* @author shinsuke
*/
public class AdminRelatedcontentAction extends FessAdminAction {
// ===================================================================================
// Attribute
// =========
@Resource
private RelatedContentService relatedContentService;
@Resource
private RelatedContentPager relatedContentPager;
// ===================================================================================
// Hook
// ======
@Override
protected void setupHtmlData(final ActionRuntime runtime) {
super.setupHtmlData(runtime);
runtime.registerData("helpLink", systemHelper.getHelpLink(fessConfig.getOnlineHelpNameRelatedcontent()));
}
// ===================================================================================
// Search Execute
// ==============
@Execute
public HtmlResponse index() {
return asListHtml();
}
@Execute
public HtmlResponse list(final OptionalThing<Integer> pageNumber, final SearchForm form) {
pageNumber.ifPresent(num -> {
relatedContentPager.setCurrentPageNumber(pageNumber.get());
}).orElse(() -> {
relatedContentPager.setCurrentPageNumber(0);
});
return asHtml(path_AdminRelatedcontent_AdminRelatedcontentJsp).renderWith(data -> {
searchPaging(data, form);
});
}
@Execute
public HtmlResponse search(final SearchForm form) {
copyBeanToBean(form, relatedContentPager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
return asHtml(path_AdminRelatedcontent_AdminRelatedcontentJsp).renderWith(data -> {
searchPaging(data, form);
});
}
@Execute
public HtmlResponse reset(final SearchForm form) {
relatedContentPager.clear();
return asHtml(path_AdminRelatedcontent_AdminRelatedcontentJsp).renderWith(data -> {
searchPaging(data, form);
});
}
protected void searchPaging(final RenderData data, final SearchForm form) {
RenderDataUtil.register(data, "relatedContentItems", relatedContentService.getRelatedContentList(relatedContentPager)); // page navi
// restore from pager
copyBeanToBean(relatedContentPager, form, op -> op.include("id"));
}
// ===================================================================================
// Edit Execute
// ============
// -----------------------------------------------------
// Entry Page
// ----------
@Execute
public HtmlResponse createnew() {
saveToken();
return asEditHtml().useForm(CreateForm.class, op -> {
op.setup(form -> {
form.initialize();
form.crudMode = CrudMode.CREATE;
});
});
}
@Execute
public HtmlResponse edit(final EditForm form) {
validate(form, messages -> {}, () -> asListHtml());
final String id = form.id;
relatedContentService.getRelatedContent(id).ifPresent(entity -> {
copyBeanToBean(entity, form, op -> {});
}).orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
});
saveToken();
if (form.crudMode.intValue() == CrudMode.EDIT) {
// back
form.crudMode = CrudMode.DETAILS;
return asDetailsHtml();
} else {
form.crudMode = CrudMode.EDIT;
return asEditHtml();
}
}
// -----------------------------------------------------
// Details
// -------
@Execute
public HtmlResponse details(final int crudMode, final String id) {
verifyCrudMode(crudMode, CrudMode.DETAILS);
saveToken();
return asDetailsHtml().useForm(EditForm.class, op -> {
op.setup(form -> {
relatedContentService.getRelatedContent(id).ifPresent(entity -> {
copyBeanToBean(entity, form, copyOp -> {
copyOp.excludeNull();
});
form.crudMode = crudMode;
}).orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
});
});
});
}
// -----------------------------------------------------
// Actually Crud
// -------------
@Execute
public HtmlResponse create(final CreateForm form) {
verifyCrudMode(form.crudMode, CrudMode.CREATE);
validate(form, messages -> {}, () -> asEditHtml());
verifyToken(() -> asEditHtml());
getRelatedContent(form).ifPresent(
entity -> {
try {
relatedContentService.store(entity);
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
} catch (final Exception e) {
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
() -> asEditHtml());
}
}).orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
});
return redirect(getClass());
}
@Execute
public HtmlResponse update(final EditForm form) {
verifyCrudMode(form.crudMode, CrudMode.EDIT);
validate(form, messages -> {}, () -> asEditHtml());
verifyToken(() -> asEditHtml());
getRelatedContent(form).ifPresent(
entity -> {
try {
relatedContentService.store(entity);
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
} catch (final Exception e) {
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
() -> asEditHtml());
}
}).orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
});
return redirect(getClass());
}
@Execute
public HtmlResponse delete(final EditForm form) {
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
validate(form, messages -> {}, () -> asDetailsHtml());
verifyToken(() -> asDetailsHtml());
final String id = form.id;
relatedContentService
.getRelatedContent(id)
.ifPresent(
entity -> {
try {
relatedContentService.delete(entity);
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
} catch (final Exception e) {
throwValidationError(
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
() -> asEditHtml());
}
}).orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
});
return redirect(getClass());
}
// ===================================================================================
// Assist Logic
// ============
private static OptionalEntity<RelatedContent> getEntity(final CreateForm form, final String username, final long currentTime) {
switch (form.crudMode) {
case CrudMode.CREATE:
return OptionalEntity.of(new RelatedContent()).map(entity -> {
entity.setCreatedBy(username);
entity.setCreatedTime(currentTime);
return entity;
});
case CrudMode.EDIT:
if (form instanceof EditForm) {
return ComponentUtil.getComponent(RelatedContentService.class).getRelatedContent(((EditForm) form).id);
}
break;
default:
break;
}
return OptionalEntity.empty();
}
public static OptionalEntity<RelatedContent> getRelatedContent(final CreateForm form) {
final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {
entity.setUpdatedBy(username);
entity.setUpdatedTime(currentTime);
BeanUtil.copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
return entity;
});
}
// ===================================================================================
// Small Helper
// ============
protected void verifyCrudMode(final int crudMode, final int expectedMode) {
if (crudMode != expectedMode) {
throwValidationError(messages -> {
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
}, () -> asListHtml());
}
}
// ===================================================================================
// JSP
// =========
private HtmlResponse asListHtml() {
return asHtml(path_AdminRelatedcontent_AdminRelatedcontentJsp).renderWith(data -> {
RenderDataUtil.register(data, "relatedContentItems", relatedContentService.getRelatedContentList(relatedContentPager));
}).useForm(SearchForm.class, setup -> {
setup.setup(form -> {
copyBeanToBean(relatedContentPager, form, op -> op.include("id"));
});
});
}
private HtmlResponse asEditHtml() {
return asHtml(path_AdminRelatedcontent_AdminRelatedcontentEditJsp);
}
private HtmlResponse asDetailsHtml() {
return asHtml(path_AdminRelatedcontent_AdminRelatedcontentDetailsJsp);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2012-2017 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.web.admin.relatedcontent;
import javax.validation.constraints.Size;
import org.codelibs.fess.app.web.CrudMode;
import org.codelibs.fess.util.ComponentUtil;
import org.lastaflute.web.validation.Required;
import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
public class CreateForm {
@ValidateTypeFailure
public Integer crudMode;
@Required
@Size(max = 10000)
public String term;
@Required
@Size(max = 10000)
public String content;
@Size(max = 1000)
public String virtualHost;
@Size(max = 1000)
public String createdBy;
@ValidateTypeFailure
public Long createdTime;
public void initialize() {
crudMode = CrudMode.CREATE;
createdBy = ComponentUtil.getSystemHelper().getUsername();
createdTime = ComponentUtil.getSystemHelper().getCurrentTimeAsLong();
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2012-2017 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.web.admin.relatedcontent;
import javax.validation.constraints.Size;
import org.lastaflute.web.validation.Required;
import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
/**
* @author shinsuke
*/
public class EditForm extends CreateForm {
@Required
@Size(max = 1000)
public String id;
@Size(max = 1000)
public String updatedBy;
@ValidateTypeFailure
public Long updatedTime;
@Required
@ValidateTypeFailure
public Integer versionNo;
}

View file

@ -0,0 +1,25 @@
/*
* Copyright 2012-2017 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.web.admin.relatedcontent;
/**
* @author shinsuke
*/
public class SearchForm {
public String id;
}

View file

@ -0,0 +1,327 @@
/*
* Copyright 2012-2017 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.web.admin.relatedquery;
import static org.codelibs.core.stream.StreamUtil.split;
import static org.codelibs.core.stream.StreamUtil.stream;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.RelatedQueryPager;
import org.codelibs.fess.app.service.RelatedQueryService;
import org.codelibs.fess.app.web.CrudMode;
import org.codelibs.fess.app.web.base.FessAdminAction;
import org.codelibs.fess.es.config.exentity.RelatedQuery;
import org.codelibs.fess.helper.SystemHelper;
import org.codelibs.fess.util.ComponentUtil;
import org.codelibs.fess.util.RenderDataUtil;
import org.dbflute.optional.OptionalEntity;
import org.dbflute.optional.OptionalThing;
import org.lastaflute.web.Execute;
import org.lastaflute.web.response.HtmlResponse;
import org.lastaflute.web.response.render.RenderData;
import org.lastaflute.web.ruts.process.ActionRuntime;
/**
* @author shinsuke
*/
public class AdminRelatedqueryAction extends FessAdminAction {
// ===================================================================================
// Attribute
// =========
@Resource
private RelatedQueryService relatedQueryService;
@Resource
private RelatedQueryPager relatedQueryPager;
// ===================================================================================
// Hook
// ======
@Override
protected void setupHtmlData(final ActionRuntime runtime) {
super.setupHtmlData(runtime);
runtime.registerData("helpLink", systemHelper.getHelpLink(fessConfig.getOnlineHelpNameRelatedquery()));
}
// ===================================================================================
// Search Execute
// ==============
@Execute
public HtmlResponse index() {
return asListHtml();
}
@Execute
public HtmlResponse list(final OptionalThing<Integer> pageNumber, final SearchForm form) {
pageNumber.ifPresent(num -> {
relatedQueryPager.setCurrentPageNumber(pageNumber.get());
}).orElse(() -> {
relatedQueryPager.setCurrentPageNumber(0);
});
return asHtml(path_AdminRelatedquery_AdminRelatedqueryJsp).renderWith(data -> {
searchPaging(data, form);
});
}
@Execute
public HtmlResponse search(final SearchForm form) {
copyBeanToBean(form, relatedQueryPager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
return asHtml(path_AdminRelatedquery_AdminRelatedqueryJsp).renderWith(data -> {
searchPaging(data, form);
});
}
@Execute
public HtmlResponse reset(final SearchForm form) {
relatedQueryPager.clear();
return asHtml(path_AdminRelatedquery_AdminRelatedqueryJsp).renderWith(data -> {
searchPaging(data, form);
});
}
protected void searchPaging(final RenderData data, final SearchForm form) {
RenderDataUtil.register(data, "relatedQueryItems", relatedQueryService.getRelatedQueryList(relatedQueryPager)); // page navi
// restore from pager
copyBeanToBean(relatedQueryPager, form, op -> op.include("id"));
}
// ===================================================================================
// Edit Execute
// ============
// -----------------------------------------------------
// Entry Page
// ----------
@Execute
public HtmlResponse createnew() {
saveToken();
return asEditHtml().useForm(CreateForm.class, op -> {
op.setup(form -> {
form.initialize();
form.crudMode = CrudMode.CREATE;
});
});
}
@Execute
public HtmlResponse edit(final EditForm form) {
validate(form, messages -> {}, () -> asListHtml());
final String id = form.id;
relatedQueryService
.getRelatedQuery(id)
.ifPresent(
entity -> {
copyBeanToBean(entity, form, copyOp -> {
copyOp.excludeNull();
copyOp.exclude(Constants.QUERIES);
});
form.queries =
stream(entity.getQueries()).get(
stream -> stream.filter(StringUtil::isNotBlank).collect(Collectors.joining("\n")));
}).orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
});
saveToken();
if (form.crudMode.intValue() == CrudMode.EDIT) {
// back
form.crudMode = CrudMode.DETAILS;
return asDetailsHtml();
} else {
form.crudMode = CrudMode.EDIT;
return asEditHtml();
}
}
// -----------------------------------------------------
// Details
// -------
@Execute
public HtmlResponse details(final int crudMode, final String id) {
verifyCrudMode(crudMode, CrudMode.DETAILS);
saveToken();
return asDetailsHtml().useForm(
EditForm.class,
op -> {
op.setup(form -> {
relatedQueryService
.getRelatedQuery(id)
.ifPresent(
entity -> {
copyBeanToBean(entity, form, copyOp -> {
copyOp.excludeNull();
copyOp.exclude(Constants.QUERIES);
});
form.queries =
stream(entity.getQueries()).get(
stream -> stream.filter(StringUtil::isNotBlank).collect(
Collectors.joining("\n")));
form.crudMode = crudMode;
})
.orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id),
() -> asListHtml());
});
});
});
}
// -----------------------------------------------------
// Actually Crud
// -------------
@Execute
public HtmlResponse create(final CreateForm form) {
verifyCrudMode(form.crudMode, CrudMode.CREATE);
validate(form, messages -> {}, () -> asEditHtml());
verifyToken(() -> asEditHtml());
getRelatedQuery(form).ifPresent(
entity -> {
try {
relatedQueryService.store(entity);
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
} catch (final Exception e) {
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
() -> asEditHtml());
}
}).orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
});
return redirect(getClass());
}
@Execute
public HtmlResponse update(final EditForm form) {
verifyCrudMode(form.crudMode, CrudMode.EDIT);
validate(form, messages -> {}, () -> asEditHtml());
verifyToken(() -> asEditHtml());
getRelatedQuery(form).ifPresent(
entity -> {
try {
relatedQueryService.store(entity);
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
} catch (final Exception e) {
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
() -> asEditHtml());
}
}).orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
});
return redirect(getClass());
}
@Execute
public HtmlResponse delete(final EditForm form) {
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
validate(form, messages -> {}, () -> asDetailsHtml());
verifyToken(() -> asDetailsHtml());
final String id = form.id;
relatedQueryService
.getRelatedQuery(id)
.ifPresent(
entity -> {
try {
relatedQueryService.delete(entity);
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
} catch (final Exception e) {
throwValidationError(
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
() -> asEditHtml());
}
}).orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
});
return redirect(getClass());
}
// ===================================================================================
// Assist Logic
// ============
private static OptionalEntity<RelatedQuery> getEntity(final CreateForm form, final String username, final long currentTime) {
switch (form.crudMode) {
case CrudMode.CREATE:
return OptionalEntity.of(new RelatedQuery()).map(entity -> {
entity.setCreatedBy(username);
entity.setCreatedTime(currentTime);
return entity;
});
case CrudMode.EDIT:
if (form instanceof EditForm) {
return ComponentUtil.getComponent(RelatedQueryService.class).getRelatedQuery(((EditForm) form).id);
}
break;
default:
break;
}
return OptionalEntity.empty();
}
public static OptionalEntity<RelatedQuery> getRelatedQuery(final CreateForm form) {
final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(
entity -> {
entity.setUpdatedBy(username);
entity.setUpdatedTime(currentTime);
BeanUtil.copyBeanToBean(form, entity, op -> op.exclude(Stream.concat(Stream.of(Constants.COMMON_CONVERSION_RULE),
Stream.of(Constants.QUERIES)).toArray(n -> new String[n])));
entity.setQueries(split(form.queries, "\n").get(
stream -> stream.filter(StringUtil::isNotBlank).toArray(n -> new String[n])));
return entity;
});
}
// ===================================================================================
// Small Helper
// ============
protected void verifyCrudMode(final int crudMode, final int expectedMode) {
if (crudMode != expectedMode) {
throwValidationError(messages -> {
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
}, () -> asListHtml());
}
}
// ===================================================================================
// JSP
// =========
private HtmlResponse asListHtml() {
return asHtml(path_AdminRelatedquery_AdminRelatedqueryJsp).renderWith(data -> {
RenderDataUtil.register(data, "relatedQueryItems", relatedQueryService.getRelatedQueryList(relatedQueryPager));
}).useForm(SearchForm.class, setup -> {
setup.setup(form -> {
copyBeanToBean(relatedQueryPager, form, op -> op.include("id"));
});
});
}
private HtmlResponse asEditHtml() {
return asHtml(path_AdminRelatedquery_AdminRelatedqueryEditJsp);
}
private HtmlResponse asDetailsHtml() {
return asHtml(path_AdminRelatedquery_AdminRelatedqueryDetailsJsp);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2012-2017 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.web.admin.relatedquery;
import javax.validation.constraints.Size;
import org.codelibs.fess.app.web.CrudMode;
import org.codelibs.fess.util.ComponentUtil;
import org.lastaflute.web.validation.Required;
import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
public class CreateForm {
@ValidateTypeFailure
public Integer crudMode;
@Required
@Size(max = 10000)
public String term;
@Required
@Size(max = 10000)
public String queries;
@Size(max = 1000)
public String virtualHost;
@Size(max = 1000)
public String createdBy;
@ValidateTypeFailure
public Long createdTime;
public void initialize() {
crudMode = CrudMode.CREATE;
createdBy = ComponentUtil.getSystemHelper().getUsername();
createdTime = ComponentUtil.getSystemHelper().getCurrentTimeAsLong();
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2012-2017 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.web.admin.relatedquery;
import javax.validation.constraints.Size;
import org.lastaflute.web.validation.Required;
import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
/**
* @author shinsuke
*/
public class EditForm extends CreateForm {
@Required
@Size(max = 1000)
public String id;
@Size(max = 1000)
public String updatedBy;
@ValidateTypeFailure
public Long updatedTime;
@Required
@ValidateTypeFailure
public Integer versionNo;
}

View file

@ -0,0 +1,25 @@
/*
* Copyright 2012-2017 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.web.admin.relatedquery;
/**
* @author shinsuke
*/
public class SearchForm {
public String id;
}

View file

@ -35,6 +35,8 @@ import org.codelibs.fess.entity.SearchRenderData;
import org.codelibs.fess.entity.SearchRequestParams.SearchRequestType;
import org.codelibs.fess.exception.InvalidQueryException;
import org.codelibs.fess.exception.ResultOffsetExceededException;
import org.codelibs.fess.helper.RelatedContentHelper;
import org.codelibs.fess.helper.RelatedQueryHelper;
import org.codelibs.fess.util.RenderDataUtil;
import org.lastaflute.taglib.function.LaFunctions;
import org.lastaflute.web.Execute;
@ -57,6 +59,12 @@ public class SearchAction extends FessSearchAction {
@Resource
protected SearchService searchService;
@Resource
protected RelatedContentHelper relatedContentHelper;
@Resource
protected RelatedQueryHelper relatedQueryHelper;
// ===================================================================================
// Hook
// ======
@ -140,6 +148,14 @@ public class SearchAction extends FessSearchAction {
RenderDataUtil.register(data, "displayQuery",
getDisplayQuery(form, labelTypeHelper.getLabelTypeItemList(SearchRequestType.SEARCH)));
createPagingQuery(form);
final String relatedContent = relatedContentHelper.getRelatedContent(form.getQuery());
if (StringUtil.isNotBlank(relatedContent)) {
RenderDataUtil.register(data, "relatedContent", relatedContent);
}
final String[] relatedQueries = relatedQueryHelper.getRelatedQueries(form.getQuery());
if (relatedQueries.length > 0) {
RenderDataUtil.register(data, "relatedQueries", relatedQueries);
}
});
} catch (final InvalidQueryException e) {
if (logger.isDebugEnabled()) {

View file

@ -79,6 +79,7 @@ public abstract class BsKeyMatchBhv extends EsAbstractBehavior<KeyMatch, KeyMatc
result.setMaxSize(DfTypeUtil.toInteger(source.get("maxSize")));
result.setQuery(DfTypeUtil.toString(source.get("query")));
result.setTerm(DfTypeUtil.toString(source.get("term")));
result.setVirtualHost(DfTypeUtil.toString(source.get("virtualHost")));
result.setUpdatedBy(DfTypeUtil.toString(source.get("updatedBy")));
result.setUpdatedTime(DfTypeUtil.toLong(source.get("updatedTime")));
return updateEntity(source, result);

View file

@ -0,0 +1,263 @@
/*
* Copyright 2012-2017 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.RequestOptionCall;
import org.codelibs.fess.es.config.bsentity.dbmeta.RelatedContentDbm;
import org.codelibs.fess.es.config.cbean.RelatedContentCB;
import org.codelibs.fess.es.config.exentity.RelatedContent;
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 BsRelatedContentBhv extends EsAbstractBehavior<RelatedContent, RelatedContentCB> {
// ===================================================================================
// Control Override
// ================
@Override
public String asTableDbName() {
return asEsIndexType();
}
@Override
protected String asEsIndex() {
return ".fess_config";
}
@Override
public String asEsIndexType() {
return "related_content";
}
@Override
public String asEsSearchType() {
return "related_content";
}
@Override
public RelatedContentDbm asDBMeta() {
return RelatedContentDbm.getInstance();
}
@Override
protected <RESULT extends RelatedContent> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
try {
final RESULT result = entityType.newInstance();
result.setCreatedBy(DfTypeUtil.toString(source.get("createdBy")));
result.setCreatedTime(DfTypeUtil.toLong(source.get("createdTime")));
result.setUpdatedBy(DfTypeUtil.toString(source.get("updatedBy")));
result.setUpdatedTime(DfTypeUtil.toLong(source.get("updatedTime")));
result.setTerm(DfTypeUtil.toString(source.get("term")));
result.setContent(DfTypeUtil.toString(source.get("content")));
result.setVirtualHost(DfTypeUtil.toString(source.get("virtualHost")));
return updateEntity(source, result);
} catch (InstantiationException | IllegalAccessException e) {
final String msg = "Cannot create a new instance: " + entityType.getName();
throw new IllegalBehaviorStateException(msg, e);
}
}
protected <RESULT extends RelatedContent> RESULT updateEntity(Map<String, Object> source, RESULT result) {
return result;
}
// ===================================================================================
// Select
// ======
public int selectCount(CBCall<RelatedContentCB> cbLambda) {
return facadeSelectCount(createCB(cbLambda));
}
public OptionalEntity<RelatedContent> selectEntity(CBCall<RelatedContentCB> cbLambda) {
return facadeSelectEntity(createCB(cbLambda));
}
protected OptionalEntity<RelatedContent> facadeSelectEntity(RelatedContentCB cb) {
return doSelectOptionalEntity(cb, typeOfSelectedEntity());
}
protected <ENTITY extends RelatedContent> OptionalEntity<ENTITY> doSelectOptionalEntity(RelatedContentCB cb, Class<? extends ENTITY> tp) {
return createOptionalEntity(doSelectEntity(cb, tp), cb);
}
@Override
public RelatedContentCB newConditionBean() {
return new RelatedContentCB();
}
@Override
protected Entity doReadEntity(ConditionBean cb) {
return facadeSelectEntity(downcast(cb)).orElse(null);
}
public RelatedContent selectEntityWithDeletedCheck(CBCall<RelatedContentCB> cbLambda) {
return facadeSelectEntityWithDeletedCheck(createCB(cbLambda));
}
public OptionalEntity<RelatedContent> selectByPK(String id) {
return facadeSelectByPK(id);
}
protected OptionalEntity<RelatedContent> facadeSelectByPK(String id) {
return doSelectOptionalByPK(id, typeOfSelectedEntity());
}
protected <ENTITY extends RelatedContent> ENTITY doSelectByPK(String id, Class<? extends ENTITY> tp) {
return doSelectEntity(xprepareCBAsPK(id), tp);
}
protected RelatedContentCB xprepareCBAsPK(String id) {
assertObjectNotNull("id", id);
return newConditionBean().acceptPK(id);
}
protected <ENTITY extends RelatedContent> OptionalEntity<ENTITY> doSelectOptionalByPK(String id, Class<? extends ENTITY> tp) {
return createOptionalEntity(doSelectByPK(id, tp), id);
}
@Override
protected Class<? extends RelatedContent> typeOfSelectedEntity() {
return RelatedContent.class;
}
@Override
protected Class<RelatedContent> typeOfHandlingEntity() {
return RelatedContent.class;
}
@Override
protected Class<RelatedContentCB> typeOfHandlingConditionBean() {
return RelatedContentCB.class;
}
public ListResultBean<RelatedContent> selectList(CBCall<RelatedContentCB> cbLambda) {
return facadeSelectList(createCB(cbLambda));
}
public PagingResultBean<RelatedContent> selectPage(CBCall<RelatedContentCB> cbLambda) {
// #pending same?
return (PagingResultBean<RelatedContent>) facadeSelectList(createCB(cbLambda));
}
public void selectCursor(CBCall<RelatedContentCB> cbLambda, EntityRowHandler<RelatedContent> entityLambda) {
facadeSelectCursor(createCB(cbLambda), entityLambda);
}
public void selectBulk(CBCall<RelatedContentCB> cbLambda, EntityRowHandler<List<RelatedContent>> entityLambda) {
delegateSelectBulk(createCB(cbLambda), entityLambda, typeOfSelectedEntity());
}
// ===================================================================================
// Update
// ======
public void insert(RelatedContent entity) {
doInsert(entity, null);
}
public void insert(RelatedContent entity, RequestOptionCall<IndexRequestBuilder> opLambda) {
entity.asDocMeta().indexOption(opLambda);
doInsert(entity, null);
}
public void update(RelatedContent entity) {
doUpdate(entity, null);
}
public void update(RelatedContent entity, RequestOptionCall<IndexRequestBuilder> opLambda) {
entity.asDocMeta().indexOption(opLambda);
doUpdate(entity, null);
}
public void insertOrUpdate(RelatedContent entity) {
doInsertOrUpdate(entity, null, null);
}
public void insertOrUpdate(RelatedContent entity, RequestOptionCall<IndexRequestBuilder> opLambda) {
entity.asDocMeta().indexOption(opLambda);
doInsertOrUpdate(entity, null, null);
}
public void delete(RelatedContent entity) {
doDelete(entity, null);
}
public void delete(RelatedContent entity, RequestOptionCall<DeleteRequestBuilder> opLambda) {
entity.asDocMeta().deleteOption(opLambda);
doDelete(entity, null);
}
public int queryDelete(CBCall<RelatedContentCB> cbLambda) {
return doQueryDelete(createCB(cbLambda), null);
}
public int[] batchInsert(List<RelatedContent> list) {
return batchInsert(list, null, null);
}
public int[] batchInsert(List<RelatedContent> list, RequestOptionCall<BulkRequestBuilder> call) {
return batchInsert(list, call, null);
}
public int[] batchInsert(List<RelatedContent> list, RequestOptionCall<BulkRequestBuilder> call,
RequestOptionCall<IndexRequestBuilder> entityCall) {
return doBatchInsert(new BulkList<>(list, call, entityCall), null);
}
public int[] batchUpdate(List<RelatedContent> list) {
return batchUpdate(list, null, null);
}
public int[] batchUpdate(List<RelatedContent> list, RequestOptionCall<BulkRequestBuilder> call) {
return batchUpdate(list, call, null);
}
public int[] batchUpdate(List<RelatedContent> list, RequestOptionCall<BulkRequestBuilder> call,
RequestOptionCall<IndexRequestBuilder> entityCall) {
return doBatchUpdate(new BulkList<>(list, call, entityCall), null);
}
public int[] batchDelete(List<RelatedContent> list) {
return batchDelete(list, null, null);
}
public int[] batchDelete(List<RelatedContent> list, RequestOptionCall<BulkRequestBuilder> call) {
return batchDelete(list, call, null);
}
public int[] batchDelete(List<RelatedContent> list, RequestOptionCall<BulkRequestBuilder> call,
RequestOptionCall<IndexRequestBuilder> entityCall) {
return doBatchDelete(new BulkList<>(list, call, entityCall), null);
}
// #pending create, modify, remove
}

View file

@ -0,0 +1,263 @@
/*
* Copyright 2012-2017 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.RequestOptionCall;
import org.codelibs.fess.es.config.bsentity.dbmeta.RelatedQueryDbm;
import org.codelibs.fess.es.config.cbean.RelatedQueryCB;
import org.codelibs.fess.es.config.exentity.RelatedQuery;
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 BsRelatedQueryBhv extends EsAbstractBehavior<RelatedQuery, RelatedQueryCB> {
// ===================================================================================
// Control Override
// ================
@Override
public String asTableDbName() {
return asEsIndexType();
}
@Override
protected String asEsIndex() {
return ".fess_config";
}
@Override
public String asEsIndexType() {
return "related_query";
}
@Override
public String asEsSearchType() {
return "related_query";
}
@Override
public RelatedQueryDbm asDBMeta() {
return RelatedQueryDbm.getInstance();
}
@Override
protected <RESULT extends RelatedQuery> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
try {
final RESULT result = entityType.newInstance();
result.setCreatedBy(DfTypeUtil.toString(source.get("createdBy")));
result.setCreatedTime(DfTypeUtil.toLong(source.get("createdTime")));
result.setUpdatedBy(DfTypeUtil.toString(source.get("updatedBy")));
result.setUpdatedTime(DfTypeUtil.toLong(source.get("updatedTime")));
result.setTerm(DfTypeUtil.toString(source.get("term")));
result.setQueries(toStringArray(source.get("queries")));
result.setVirtualHost(DfTypeUtil.toString(source.get("virtualHost")));
return updateEntity(source, result);
} catch (InstantiationException | IllegalAccessException e) {
final String msg = "Cannot create a new instance: " + entityType.getName();
throw new IllegalBehaviorStateException(msg, e);
}
}
protected <RESULT extends RelatedQuery> RESULT updateEntity(Map<String, Object> source, RESULT result) {
return result;
}
// ===================================================================================
// Select
// ======
public int selectCount(CBCall<RelatedQueryCB> cbLambda) {
return facadeSelectCount(createCB(cbLambda));
}
public OptionalEntity<RelatedQuery> selectEntity(CBCall<RelatedQueryCB> cbLambda) {
return facadeSelectEntity(createCB(cbLambda));
}
protected OptionalEntity<RelatedQuery> facadeSelectEntity(RelatedQueryCB cb) {
return doSelectOptionalEntity(cb, typeOfSelectedEntity());
}
protected <ENTITY extends RelatedQuery> OptionalEntity<ENTITY> doSelectOptionalEntity(RelatedQueryCB cb, Class<? extends ENTITY> tp) {
return createOptionalEntity(doSelectEntity(cb, tp), cb);
}
@Override
public RelatedQueryCB newConditionBean() {
return new RelatedQueryCB();
}
@Override
protected Entity doReadEntity(ConditionBean cb) {
return facadeSelectEntity(downcast(cb)).orElse(null);
}
public RelatedQuery selectEntityWithDeletedCheck(CBCall<RelatedQueryCB> cbLambda) {
return facadeSelectEntityWithDeletedCheck(createCB(cbLambda));
}
public OptionalEntity<RelatedQuery> selectByPK(String id) {
return facadeSelectByPK(id);
}
protected OptionalEntity<RelatedQuery> facadeSelectByPK(String id) {
return doSelectOptionalByPK(id, typeOfSelectedEntity());
}
protected <ENTITY extends RelatedQuery> ENTITY doSelectByPK(String id, Class<? extends ENTITY> tp) {
return doSelectEntity(xprepareCBAsPK(id), tp);
}
protected RelatedQueryCB xprepareCBAsPK(String id) {
assertObjectNotNull("id", id);
return newConditionBean().acceptPK(id);
}
protected <ENTITY extends RelatedQuery> OptionalEntity<ENTITY> doSelectOptionalByPK(String id, Class<? extends ENTITY> tp) {
return createOptionalEntity(doSelectByPK(id, tp), id);
}
@Override
protected Class<? extends RelatedQuery> typeOfSelectedEntity() {
return RelatedQuery.class;
}
@Override
protected Class<RelatedQuery> typeOfHandlingEntity() {
return RelatedQuery.class;
}
@Override
protected Class<RelatedQueryCB> typeOfHandlingConditionBean() {
return RelatedQueryCB.class;
}
public ListResultBean<RelatedQuery> selectList(CBCall<RelatedQueryCB> cbLambda) {
return facadeSelectList(createCB(cbLambda));
}
public PagingResultBean<RelatedQuery> selectPage(CBCall<RelatedQueryCB> cbLambda) {
// #pending same?
return (PagingResultBean<RelatedQuery>) facadeSelectList(createCB(cbLambda));
}
public void selectCursor(CBCall<RelatedQueryCB> cbLambda, EntityRowHandler<RelatedQuery> entityLambda) {
facadeSelectCursor(createCB(cbLambda), entityLambda);
}
public void selectBulk(CBCall<RelatedQueryCB> cbLambda, EntityRowHandler<List<RelatedQuery>> entityLambda) {
delegateSelectBulk(createCB(cbLambda), entityLambda, typeOfSelectedEntity());
}
// ===================================================================================
// Update
// ======
public void insert(RelatedQuery entity) {
doInsert(entity, null);
}
public void insert(RelatedQuery entity, RequestOptionCall<IndexRequestBuilder> opLambda) {
entity.asDocMeta().indexOption(opLambda);
doInsert(entity, null);
}
public void update(RelatedQuery entity) {
doUpdate(entity, null);
}
public void update(RelatedQuery entity, RequestOptionCall<IndexRequestBuilder> opLambda) {
entity.asDocMeta().indexOption(opLambda);
doUpdate(entity, null);
}
public void insertOrUpdate(RelatedQuery entity) {
doInsertOrUpdate(entity, null, null);
}
public void insertOrUpdate(RelatedQuery entity, RequestOptionCall<IndexRequestBuilder> opLambda) {
entity.asDocMeta().indexOption(opLambda);
doInsertOrUpdate(entity, null, null);
}
public void delete(RelatedQuery entity) {
doDelete(entity, null);
}
public void delete(RelatedQuery entity, RequestOptionCall<DeleteRequestBuilder> opLambda) {
entity.asDocMeta().deleteOption(opLambda);
doDelete(entity, null);
}
public int queryDelete(CBCall<RelatedQueryCB> cbLambda) {
return doQueryDelete(createCB(cbLambda), null);
}
public int[] batchInsert(List<RelatedQuery> list) {
return batchInsert(list, null, null);
}
public int[] batchInsert(List<RelatedQuery> list, RequestOptionCall<BulkRequestBuilder> call) {
return batchInsert(list, call, null);
}
public int[] batchInsert(List<RelatedQuery> list, RequestOptionCall<BulkRequestBuilder> call,
RequestOptionCall<IndexRequestBuilder> entityCall) {
return doBatchInsert(new BulkList<>(list, call, entityCall), null);
}
public int[] batchUpdate(List<RelatedQuery> list) {
return batchUpdate(list, null, null);
}
public int[] batchUpdate(List<RelatedQuery> list, RequestOptionCall<BulkRequestBuilder> call) {
return batchUpdate(list, call, null);
}
public int[] batchUpdate(List<RelatedQuery> list, RequestOptionCall<BulkRequestBuilder> call,
RequestOptionCall<IndexRequestBuilder> entityCall) {
return doBatchUpdate(new BulkList<>(list, call, entityCall), null);
}
public int[] batchDelete(List<RelatedQuery> list) {
return batchDelete(list, null, null);
}
public int[] batchDelete(List<RelatedQuery> list, RequestOptionCall<BulkRequestBuilder> call) {
return batchDelete(list, call, null);
}
public int[] batchDelete(List<RelatedQuery> list, RequestOptionCall<BulkRequestBuilder> call,
RequestOptionCall<IndexRequestBuilder> entityCall) {
return doBatchDelete(new BulkList<>(list, call, entityCall), null);
}
// #pending create, modify, remove
}

View file

@ -55,6 +55,9 @@ public class BsKeyMatch extends EsAbstractEntity {
/** term */
protected String term;
/** virtualHost */
protected String virtualHost;
/** updatedBy */
protected String updatedBy;
@ -100,6 +103,9 @@ public class BsKeyMatch extends EsAbstractEntity {
if (term != null) {
addFieldToSource(sourceMap, "term", term);
}
if (virtualHost != null) {
addFieldToSource(sourceMap, "virtualHost", virtualHost);
}
if (updatedBy != null) {
addFieldToSource(sourceMap, "updatedBy", updatedBy);
}
@ -125,6 +131,7 @@ public class BsKeyMatch extends EsAbstractEntity {
sb.append(dm).append(maxSize);
sb.append(dm).append(query);
sb.append(dm).append(term);
sb.append(dm).append(virtualHost);
sb.append(dm).append(updatedBy);
sb.append(dm).append(updatedTime);
if (sb.length() > dm.length()) {
@ -197,6 +204,16 @@ public class BsKeyMatch extends EsAbstractEntity {
this.term = value;
}
public String getVirtualHost() {
checkSpecifiedProperty("virtualHost");
return convertEmptyToNull(virtualHost);
}
public void setVirtualHost(String value) {
registerModifiedProperty("virtualHost");
this.virtualHost = value;
}
public String getUpdatedBy() {
checkSpecifiedProperty("updatedBy");
return convertEmptyToNull(updatedBy);

View file

@ -0,0 +1,202 @@
/*
* Copyright 2012-2017 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.RelatedContentDbm;
/**
* ${table.comment}
* @author ESFlute (using FreeGen)
*/
public class BsRelatedContent extends EsAbstractEntity {
// ===================================================================================
// Definition
// ==========
private static final long serialVersionUID = 1L;
protected static final Class<?> suppressUnusedImportLocalDateTime = LocalDateTime.class;
// ===================================================================================
// Attribute
// =========
/** createdBy */
protected String createdBy;
/** createdTime */
protected Long createdTime;
/** updatedBy */
protected String updatedBy;
/** updatedTime */
protected Long updatedTime;
/** term */
protected String term;
/** content */
protected String content;
/** virtualHost */
protected String virtualHost;
// [Referrers] *comment only
// ===================================================================================
// DB Meta
// =======
@Override
public RelatedContentDbm asDBMeta() {
return RelatedContentDbm.getInstance();
}
@Override
public String asTableDbName() {
return "related_content";
}
// ===================================================================================
// Source
// ======
@Override
public Map<String, Object> toSource() {
Map<String, Object> sourceMap = new HashMap<>();
if (createdBy != null) {
addFieldToSource(sourceMap, "createdBy", createdBy);
}
if (createdTime != null) {
addFieldToSource(sourceMap, "createdTime", createdTime);
}
if (updatedBy != null) {
addFieldToSource(sourceMap, "updatedBy", updatedBy);
}
if (updatedTime != null) {
addFieldToSource(sourceMap, "updatedTime", updatedTime);
}
if (term != null) {
addFieldToSource(sourceMap, "term", term);
}
if (content != null) {
addFieldToSource(sourceMap, "content", content);
}
if (virtualHost != null) {
addFieldToSource(sourceMap, "virtualHost", virtualHost);
}
return sourceMap;
}
protected void addFieldToSource(Map<String, Object> sourceMap, String field, Object value) {
sourceMap.put(field, value);
}
// ===================================================================================
// Basic Override
// ==============
@Override
protected String doBuildColumnString(String dm) {
StringBuilder sb = new StringBuilder();
sb.append(dm).append(createdBy);
sb.append(dm).append(createdTime);
sb.append(dm).append(updatedBy);
sb.append(dm).append(updatedTime);
sb.append(dm).append(term);
sb.append(dm).append(content);
sb.append(dm).append(virtualHost);
if (sb.length() > dm.length()) {
sb.delete(0, dm.length());
}
sb.insert(0, "{").append("}");
return sb.toString();
}
// ===================================================================================
// Accessor
// ========
public String getCreatedBy() {
checkSpecifiedProperty("createdBy");
return convertEmptyToNull(createdBy);
}
public void setCreatedBy(String value) {
registerModifiedProperty("createdBy");
this.createdBy = value;
}
public Long getCreatedTime() {
checkSpecifiedProperty("createdTime");
return createdTime;
}
public void setCreatedTime(Long value) {
registerModifiedProperty("createdTime");
this.createdTime = value;
}
public String getUpdatedBy() {
checkSpecifiedProperty("updatedBy");
return convertEmptyToNull(updatedBy);
}
public void setUpdatedBy(String value) {
registerModifiedProperty("updatedBy");
this.updatedBy = value;
}
public Long getUpdatedTime() {
checkSpecifiedProperty("updatedTime");
return updatedTime;
}
public void setUpdatedTime(Long value) {
registerModifiedProperty("updatedTime");
this.updatedTime = value;
}
public String getTerm() {
checkSpecifiedProperty("term");
return convertEmptyToNull(term);
}
public void setTerm(String value) {
registerModifiedProperty("term");
this.term = value;
}
public String getContent() {
checkSpecifiedProperty("content");
return convertEmptyToNull(content);
}
public void setContent(String value) {
registerModifiedProperty("content");
this.content = value;
}
public String getVirtualHost() {
checkSpecifiedProperty("virtualHost");
return convertEmptyToNull(virtualHost);
}
public void setVirtualHost(String value) {
registerModifiedProperty("virtualHost");
this.virtualHost = value;
}
}

View file

@ -0,0 +1,202 @@
/*
* Copyright 2012-2017 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.RelatedQueryDbm;
/**
* ${table.comment}
* @author ESFlute (using FreeGen)
*/
public class BsRelatedQuery extends EsAbstractEntity {
// ===================================================================================
// Definition
// ==========
private static final long serialVersionUID = 1L;
protected static final Class<?> suppressUnusedImportLocalDateTime = LocalDateTime.class;
// ===================================================================================
// Attribute
// =========
/** createdBy */
protected String createdBy;
/** createdTime */
protected Long createdTime;
/** updatedBy */
protected String updatedBy;
/** updatedTime */
protected Long updatedTime;
/** term */
protected String term;
/** queries */
protected String[] queries;
/** virtualHost */
protected String virtualHost;
// [Referrers] *comment only
// ===================================================================================
// DB Meta
// =======
@Override
public RelatedQueryDbm asDBMeta() {
return RelatedQueryDbm.getInstance();
}
@Override
public String asTableDbName() {
return "related_query";
}
// ===================================================================================
// Source
// ======
@Override
public Map<String, Object> toSource() {
Map<String, Object> sourceMap = new HashMap<>();
if (createdBy != null) {
addFieldToSource(sourceMap, "createdBy", createdBy);
}
if (createdTime != null) {
addFieldToSource(sourceMap, "createdTime", createdTime);
}
if (updatedBy != null) {
addFieldToSource(sourceMap, "updatedBy", updatedBy);
}
if (updatedTime != null) {
addFieldToSource(sourceMap, "updatedTime", updatedTime);
}
if (term != null) {
addFieldToSource(sourceMap, "term", term);
}
if (queries != null) {
addFieldToSource(sourceMap, "queries", queries);
}
if (virtualHost != null) {
addFieldToSource(sourceMap, "virtualHost", virtualHost);
}
return sourceMap;
}
protected void addFieldToSource(Map<String, Object> sourceMap, String field, Object value) {
sourceMap.put(field, value);
}
// ===================================================================================
// Basic Override
// ==============
@Override
protected String doBuildColumnString(String dm) {
StringBuilder sb = new StringBuilder();
sb.append(dm).append(createdBy);
sb.append(dm).append(createdTime);
sb.append(dm).append(updatedBy);
sb.append(dm).append(updatedTime);
sb.append(dm).append(term);
sb.append(dm).append(queries);
sb.append(dm).append(virtualHost);
if (sb.length() > dm.length()) {
sb.delete(0, dm.length());
}
sb.insert(0, "{").append("}");
return sb.toString();
}
// ===================================================================================
// Accessor
// ========
public String getCreatedBy() {
checkSpecifiedProperty("createdBy");
return convertEmptyToNull(createdBy);
}
public void setCreatedBy(String value) {
registerModifiedProperty("createdBy");
this.createdBy = value;
}
public Long getCreatedTime() {
checkSpecifiedProperty("createdTime");
return createdTime;
}
public void setCreatedTime(Long value) {
registerModifiedProperty("createdTime");
this.createdTime = value;
}
public String getUpdatedBy() {
checkSpecifiedProperty("updatedBy");
return convertEmptyToNull(updatedBy);
}
public void setUpdatedBy(String value) {
registerModifiedProperty("updatedBy");
this.updatedBy = value;
}
public Long getUpdatedTime() {
checkSpecifiedProperty("updatedTime");
return updatedTime;
}
public void setUpdatedTime(Long value) {
registerModifiedProperty("updatedTime");
this.updatedTime = value;
}
public String getTerm() {
checkSpecifiedProperty("term");
return convertEmptyToNull(term);
}
public void setTerm(String value) {
registerModifiedProperty("term");
this.term = value;
}
public String[] getQueries() {
checkSpecifiedProperty("queries");
return queries;
}
public void setQueries(String[] value) {
registerModifiedProperty("queries");
this.queries = value;
}
public String getVirtualHost() {
checkSpecifiedProperty("virtualHost");
return convertEmptyToNull(virtualHost);
}
public void setVirtualHost(String value) {
registerModifiedProperty("virtualHost");
this.virtualHost = value;
}
}

View file

@ -87,6 +87,8 @@ public class KeyMatchDbm extends AbstractDBMeta {
setupEpg(_epgMap, et -> ((KeyMatch) et).getMaxSize(), (et, vl) -> ((KeyMatch) et).setMaxSize(DfTypeUtil.toInteger(vl)), "maxSize");
setupEpg(_epgMap, et -> ((KeyMatch) et).getQuery(), (et, vl) -> ((KeyMatch) et).setQuery(DfTypeUtil.toString(vl)), "query");
setupEpg(_epgMap, et -> ((KeyMatch) et).getTerm(), (et, vl) -> ((KeyMatch) et).setTerm(DfTypeUtil.toString(vl)), "term");
setupEpg(_epgMap, et -> ((KeyMatch) et).getVirtualHost(), (et, vl) -> ((KeyMatch) et).setVirtualHost(DfTypeUtil.toString(vl)),
"virtualHost");
setupEpg(_epgMap, et -> ((KeyMatch) et).getUpdatedBy(), (et, vl) -> ((KeyMatch) et).setUpdatedBy(DfTypeUtil.toString(vl)),
"updatedBy");
setupEpg(_epgMap, et -> ((KeyMatch) et).getUpdatedTime(), (et, vl) -> ((KeyMatch) et).setUpdatedTime(DfTypeUtil.toLong(vl)),
@ -139,6 +141,8 @@ public class KeyMatchDbm extends AbstractDBMeta {
"keyword", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnTerm = cci("term", "term", null, null, String.class, "term", null, false, false, false, "keyword", 0,
0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnVirtualHost = cci("virtualHost", "virtualHost", null, null, String.class, "virtualHost", null, false,
false, false, "keyword", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnUpdatedBy = cci("updatedBy", "updatedBy", null, null, String.class, "updatedBy", null, false, false,
false, "keyword", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnUpdatedTime = cci("updatedTime", "updatedTime", null, null, Long.class, "updatedTime", null, false,
@ -168,6 +172,10 @@ public class KeyMatchDbm extends AbstractDBMeta {
return _columnTerm;
}
public ColumnInfo columnVirtualHost() {
return _columnVirtualHost;
}
public ColumnInfo columnUpdatedBy() {
return _columnUpdatedBy;
}
@ -184,6 +192,7 @@ public class KeyMatchDbm extends AbstractDBMeta {
ls.add(columnMaxSize());
ls.add(columnQuery());
ls.add(columnTerm());
ls.add(columnVirtualHost());
ls.add(columnUpdatedBy());
ls.add(columnUpdatedTime());
return ls;

View file

@ -0,0 +1,258 @@
/*
* Copyright 2012-2017 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.RelatedContent;
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 RelatedContentDbm extends AbstractDBMeta {
protected static final Class<?> suppressUnusedImportLocalDateTime = LocalDateTime.class;
// ===================================================================================
// Singleton
// =========
private static final RelatedContentDbm _instance = new RelatedContentDbm();
private RelatedContentDbm() {
}
public static RelatedContentDbm 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 -> ((RelatedContent) et).getCreatedBy(),
(et, vl) -> ((RelatedContent) et).setCreatedBy(DfTypeUtil.toString(vl)), "createdBy");
setupEpg(_epgMap, et -> ((RelatedContent) et).getCreatedTime(),
(et, vl) -> ((RelatedContent) et).setCreatedTime(DfTypeUtil.toLong(vl)), "createdTime");
setupEpg(_epgMap, et -> ((RelatedContent) et).getUpdatedBy(),
(et, vl) -> ((RelatedContent) et).setUpdatedBy(DfTypeUtil.toString(vl)), "updatedBy");
setupEpg(_epgMap, et -> ((RelatedContent) et).getUpdatedTime(),
(et, vl) -> ((RelatedContent) et).setUpdatedTime(DfTypeUtil.toLong(vl)), "updatedTime");
setupEpg(_epgMap, et -> ((RelatedContent) et).getTerm(), (et, vl) -> ((RelatedContent) et).setTerm(DfTypeUtil.toString(vl)), "term");
setupEpg(_epgMap, et -> ((RelatedContent) et).getContent(), (et, vl) -> ((RelatedContent) et).setContent(DfTypeUtil.toString(vl)),
"content");
setupEpg(_epgMap, et -> ((RelatedContent) et).getVirtualHost(),
(et, vl) -> ((RelatedContent) et).setVirtualHost(DfTypeUtil.toString(vl)), "virtualHost");
}
@Override
public PropertyGateway findPropertyGateway(final String prop) {
return doFindEpg(_epgMap, prop);
}
// ===================================================================================
// Table Info
// ==========
protected final String _tableDbName = "related_content";
protected final String _tableDispName = "related_content";
protected final String _tablePropertyName = "RelatedContent";
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 _columnCreatedBy = cci("createdBy", "createdBy", null, null, String.class, "createdBy", null, false, false,
false, "keyword", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnCreatedTime = cci("createdTime", "createdTime", null, null, Long.class, "createdTime", null, false,
false, false, "Long", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnUpdatedBy = cci("updatedBy", "updatedBy", null, null, String.class, "updatedBy", null, false, false,
false, "keyword", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnUpdatedTime = cci("updatedTime", "updatedTime", null, null, Long.class, "updatedTime", null, false,
false, false, "Long", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnTerm = cci("term", "term", null, null, String.class, "term", null, false, false, false, "keyword", 0,
0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnContent = cci("content", "content", null, null, String.class, "content", null, false, false, false,
"keyword", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnVirtualHost = cci("virtualHost", "virtualHost", null, null, String.class, "virtualHost", null, false,
false, false, "keyword", 0, 0, null, false, null, null, null, null, null, false);
public ColumnInfo columnCreatedBy() {
return _columnCreatedBy;
}
public ColumnInfo columnCreatedTime() {
return _columnCreatedTime;
}
public ColumnInfo columnUpdatedBy() {
return _columnUpdatedBy;
}
public ColumnInfo columnUpdatedTime() {
return _columnUpdatedTime;
}
public ColumnInfo columnTerm() {
return _columnTerm;
}
public ColumnInfo columnContent() {
return _columnContent;
}
public ColumnInfo columnVirtualHost() {
return _columnVirtualHost;
}
protected List<ColumnInfo> ccil() {
List<ColumnInfo> ls = newArrayList();
ls.add(columnCreatedBy());
ls.add(columnCreatedTime());
ls.add(columnUpdatedBy());
ls.add(columnUpdatedTime());
ls.add(columnTerm());
ls.add(columnContent());
ls.add(columnVirtualHost());
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.RelatedContent";
}
@Override
public String getConditionBeanTypeName() {
return "org.codelibs.fess.es.config.cbean.RelatedContentCB";
}
@Override
public String getBehaviorTypeName() {
return "org.codelibs.fess.es.config.exbhv.RelatedContentBhv";
}
// ===================================================================================
// Object Type
// ===========
@Override
public Class<? extends Entity> getEntityType() {
return RelatedContent.class;
}
// ===================================================================================
// Object Instance
// ===============
@Override
public Entity newEntity() {
return new RelatedContent();
}
// ===================================================================================
// 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;
}
}

View file

@ -0,0 +1,257 @@
/*
* Copyright 2012-2017 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.RelatedQuery;
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 RelatedQueryDbm extends AbstractDBMeta {
protected static final Class<?> suppressUnusedImportLocalDateTime = LocalDateTime.class;
// ===================================================================================
// Singleton
// =========
private static final RelatedQueryDbm _instance = new RelatedQueryDbm();
private RelatedQueryDbm() {
}
public static RelatedQueryDbm 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 -> ((RelatedQuery) et).getCreatedBy(), (et, vl) -> ((RelatedQuery) et).setCreatedBy(DfTypeUtil.toString(vl)),
"createdBy");
setupEpg(_epgMap, et -> ((RelatedQuery) et).getCreatedTime(),
(et, vl) -> ((RelatedQuery) et).setCreatedTime(DfTypeUtil.toLong(vl)), "createdTime");
setupEpg(_epgMap, et -> ((RelatedQuery) et).getUpdatedBy(), (et, vl) -> ((RelatedQuery) et).setUpdatedBy(DfTypeUtil.toString(vl)),
"updatedBy");
setupEpg(_epgMap, et -> ((RelatedQuery) et).getUpdatedTime(),
(et, vl) -> ((RelatedQuery) et).setUpdatedTime(DfTypeUtil.toLong(vl)), "updatedTime");
setupEpg(_epgMap, et -> ((RelatedQuery) et).getTerm(), (et, vl) -> ((RelatedQuery) et).setTerm(DfTypeUtil.toString(vl)), "term");
setupEpg(_epgMap, et -> ((RelatedQuery) et).getQueries(), (et, vl) -> ((RelatedQuery) et).setQueries((String[]) vl), "queries");
setupEpg(_epgMap, et -> ((RelatedQuery) et).getVirtualHost(),
(et, vl) -> ((RelatedQuery) et).setVirtualHost(DfTypeUtil.toString(vl)), "virtualHost");
}
@Override
public PropertyGateway findPropertyGateway(final String prop) {
return doFindEpg(_epgMap, prop);
}
// ===================================================================================
// Table Info
// ==========
protected final String _tableDbName = "related_query";
protected final String _tableDispName = "related_query";
protected final String _tablePropertyName = "RelatedQuery";
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 _columnCreatedBy = cci("createdBy", "createdBy", null, null, String.class, "createdBy", null, false, false,
false, "keyword", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnCreatedTime = cci("createdTime", "createdTime", null, null, Long.class, "createdTime", null, false,
false, false, "Long", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnUpdatedBy = cci("updatedBy", "updatedBy", null, null, String.class, "updatedBy", null, false, false,
false, "keyword", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnUpdatedTime = cci("updatedTime", "updatedTime", null, null, Long.class, "updatedTime", null, false,
false, false, "Long", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnTerm = cci("term", "term", null, null, String.class, "term", null, false, false, false, "keyword", 0,
0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnQueries = cci("queries", "queries", null, null, String[].class, "queries", null, false, false, false,
"keyword", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnVirtualHost = cci("virtualHost", "virtualHost", null, null, String.class, "virtualHost", null, false,
false, false, "keyword", 0, 0, null, false, null, null, null, null, null, false);
public ColumnInfo columnCreatedBy() {
return _columnCreatedBy;
}
public ColumnInfo columnCreatedTime() {
return _columnCreatedTime;
}
public ColumnInfo columnUpdatedBy() {
return _columnUpdatedBy;
}
public ColumnInfo columnUpdatedTime() {
return _columnUpdatedTime;
}
public ColumnInfo columnTerm() {
return _columnTerm;
}
public ColumnInfo columnQueries() {
return _columnQueries;
}
public ColumnInfo columnVirtualHost() {
return _columnVirtualHost;
}
protected List<ColumnInfo> ccil() {
List<ColumnInfo> ls = newArrayList();
ls.add(columnCreatedBy());
ls.add(columnCreatedTime());
ls.add(columnUpdatedBy());
ls.add(columnUpdatedTime());
ls.add(columnTerm());
ls.add(columnQueries());
ls.add(columnVirtualHost());
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.RelatedQuery";
}
@Override
public String getConditionBeanTypeName() {
return "org.codelibs.fess.es.config.cbean.RelatedQueryCB";
}
@Override
public String getBehaviorTypeName() {
return "org.codelibs.fess.es.config.exbhv.RelatedQueryBhv";
}
// ===================================================================================
// Object Type
// ===========
@Override
public Class<? extends Entity> getEntityType() {
return RelatedQuery.class;
}
// ===================================================================================
// Object Instance
// ===============
@Override
public Entity newEntity() {
return new RelatedQuery();
}
// ===================================================================================
// 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;
}
}

View file

@ -0,0 +1,24 @@
/*
* Copyright 2012-2017 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.BsRelatedContentCB;
/**
* @author ESFlute (using FreeGen)
*/
public class RelatedContentCB extends BsRelatedContentCB {
}

View file

@ -0,0 +1,24 @@
/*
* Copyright 2012-2017 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.BsRelatedQueryCB;
/**
* @author ESFlute (using FreeGen)
*/
public class RelatedQueryCB extends BsRelatedQueryCB {
}

View file

@ -200,6 +200,10 @@ public class BsKeyMatchCB extends EsAbstractConditionBean {
doColumn("term");
}
public void columnVirtualHost() {
doColumn("virtualHost");
}
public void columnUpdatedBy() {
doColumn("updatedBy");
}

View file

@ -0,0 +1,207 @@
/*
* Copyright 2012-2017 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.RelatedContentDbm;
import org.codelibs.fess.es.config.cbean.RelatedContentCB;
import org.codelibs.fess.es.config.cbean.ca.RelatedContentCA;
import org.codelibs.fess.es.config.cbean.ca.bs.BsRelatedContentCA;
import org.codelibs.fess.es.config.cbean.cq.RelatedContentCQ;
import org.codelibs.fess.es.config.cbean.cq.bs.BsRelatedContentCQ;
import org.dbflute.cbean.ConditionQuery;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.index.query.QueryBuilder;
/**
* @author ESFlute (using FreeGen)
*/
public class BsRelatedContentCB extends EsAbstractConditionBean {
// ===================================================================================
// Attribute
// =========
protected BsRelatedContentCQ _conditionQuery;
protected BsRelatedContentCA _conditionAggregation;
protected HpSpecification _specification;
// ===================================================================================
// Control
// =======
@Override
public RelatedContentDbm asDBMeta() {
return RelatedContentDbm.getInstance();
}
@Override
public String asTableDbName() {
return "related_content";
}
@Override
public boolean hasSpecifiedColumn() {
return _specification != null;
}
@Override
public ConditionQuery localCQ() {
return doGetConditionQuery();
}
// ===================================================================================
// Primary Key
// ===========
public RelatedContentCB acceptPK(String id) {
assertObjectNotNull("id", id);
BsRelatedContentCB cb = this;
cb.query().docMeta().setId_Equal(id);
return (RelatedContentCB) this;
}
@Override
public void acceptPrimaryKeyMap(Map<String, ? extends Object> primaryKeyMap) {
acceptPK((String) primaryKeyMap.get("_id"));
}
// ===================================================================================
// Build
// =====
@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 (_conditionAggregation != null) {
_conditionAggregation.getAggregationBuilderList().forEach(builder::addAggregation);
}
if (_specification != null) {
builder.setFetchSource(_specification.columnList.toArray(new String[_specification.columnList.size()]), null);
}
return builder;
}
// ===================================================================================
// Query
// =====
public BsRelatedContentCQ query() {
assertQueryPurpose();
return doGetConditionQuery();
}
protected BsRelatedContentCQ doGetConditionQuery() {
if (_conditionQuery == null) {
_conditionQuery = createLocalCQ();
}
return _conditionQuery;
}
protected BsRelatedContentCQ createLocalCQ() {
return new RelatedContentCQ();
}
// ===================================================================================
// Aggregation
// ===========
public BsRelatedContentCA aggregation() {
assertAggregationPurpose();
return doGetConditionAggregation();
}
protected BsRelatedContentCA doGetConditionAggregation() {
if (_conditionAggregation == null) {
_conditionAggregation = createLocalCA();
}
return _conditionAggregation;
}
protected BsRelatedContentCA createLocalCA() {
return new RelatedContentCA();
}
// ===================================================================================
// Specify
// =======
public HpSpecification specify() {
assertSpecifyPurpose();
if (_specification == null) {
_specification = new HpSpecification();
}
return _specification;
}
protected void assertQueryPurpose() {
}
protected void assertAggregationPurpose() {
}
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 columnCreatedBy() {
doColumn("createdBy");
}
public void columnCreatedTime() {
doColumn("createdTime");
}
public void columnUpdatedBy() {
doColumn("updatedBy");
}
public void columnUpdatedTime() {
doColumn("updatedTime");
}
public void columnTerm() {
doColumn("term");
}
public void columnContent() {
doColumn("content");
}
public void columnVirtualHost() {
doColumn("virtualHost");
}
}
}

View file

@ -0,0 +1,207 @@
/*
* Copyright 2012-2017 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.RelatedQueryDbm;
import org.codelibs.fess.es.config.cbean.RelatedQueryCB;
import org.codelibs.fess.es.config.cbean.ca.RelatedQueryCA;
import org.codelibs.fess.es.config.cbean.ca.bs.BsRelatedQueryCA;
import org.codelibs.fess.es.config.cbean.cq.RelatedQueryCQ;
import org.codelibs.fess.es.config.cbean.cq.bs.BsRelatedQueryCQ;
import org.dbflute.cbean.ConditionQuery;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.index.query.QueryBuilder;
/**
* @author ESFlute (using FreeGen)
*/
public class BsRelatedQueryCB extends EsAbstractConditionBean {
// ===================================================================================
// Attribute
// =========
protected BsRelatedQueryCQ _conditionQuery;
protected BsRelatedQueryCA _conditionAggregation;
protected HpSpecification _specification;
// ===================================================================================
// Control
// =======
@Override
public RelatedQueryDbm asDBMeta() {
return RelatedQueryDbm.getInstance();
}
@Override
public String asTableDbName() {
return "related_query";
}
@Override
public boolean hasSpecifiedColumn() {
return _specification != null;
}
@Override
public ConditionQuery localCQ() {
return doGetConditionQuery();
}
// ===================================================================================
// Primary Key
// ===========
public RelatedQueryCB acceptPK(String id) {
assertObjectNotNull("id", id);
BsRelatedQueryCB cb = this;
cb.query().docMeta().setId_Equal(id);
return (RelatedQueryCB) this;
}
@Override
public void acceptPrimaryKeyMap(Map<String, ? extends Object> primaryKeyMap) {
acceptPK((String) primaryKeyMap.get("_id"));
}
// ===================================================================================
// Build
// =====
@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 (_conditionAggregation != null) {
_conditionAggregation.getAggregationBuilderList().forEach(builder::addAggregation);
}
if (_specification != null) {
builder.setFetchSource(_specification.columnList.toArray(new String[_specification.columnList.size()]), null);
}
return builder;
}
// ===================================================================================
// Query
// =====
public BsRelatedQueryCQ query() {
assertQueryPurpose();
return doGetConditionQuery();
}
protected BsRelatedQueryCQ doGetConditionQuery() {
if (_conditionQuery == null) {
_conditionQuery = createLocalCQ();
}
return _conditionQuery;
}
protected BsRelatedQueryCQ createLocalCQ() {
return new RelatedQueryCQ();
}
// ===================================================================================
// Aggregation
// ===========
public BsRelatedQueryCA aggregation() {
assertAggregationPurpose();
return doGetConditionAggregation();
}
protected BsRelatedQueryCA doGetConditionAggregation() {
if (_conditionAggregation == null) {
_conditionAggregation = createLocalCA();
}
return _conditionAggregation;
}
protected BsRelatedQueryCA createLocalCA() {
return new RelatedQueryCA();
}
// ===================================================================================
// Specify
// =======
public HpSpecification specify() {
assertSpecifyPurpose();
if (_specification == null) {
_specification = new HpSpecification();
}
return _specification;
}
protected void assertQueryPurpose() {
}
protected void assertAggregationPurpose() {
}
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 columnCreatedBy() {
doColumn("createdBy");
}
public void columnCreatedTime() {
doColumn("createdTime");
}
public void columnUpdatedBy() {
doColumn("updatedBy");
}
public void columnUpdatedTime() {
doColumn("updatedTime");
}
public void columnTerm() {
doColumn("term");
}
public void columnQueries() {
doColumn("queries");
}
public void columnVirtualHost() {
doColumn("virtualHost");
}
}
}

View file

@ -0,0 +1,24 @@
/*
* Copyright 2012-2017 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.ca;
import org.codelibs.fess.es.config.cbean.ca.bs.BsRelatedContentCA;
/**
* @author ESFlute (using FreeGen)
*/
public class RelatedContentCA extends BsRelatedContentCA {
}

View file

@ -0,0 +1,24 @@
/*
* Copyright 2012-2017 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.ca;
import org.codelibs.fess.es.config.cbean.ca.bs.BsRelatedQueryCA;
/**
* @author ESFlute (using FreeGen)
*/
public class RelatedQueryCA extends BsRelatedQueryCA {
}

View file

@ -1164,6 +1164,137 @@ public abstract class BsKeyMatchCA extends EsAbstractConditionAggregation {
}
}
public void setVirtualHost_Terms() {
setVirtualHost_Terms(null);
}
public void setVirtualHost_Terms(ConditionOptionCall<TermsAggregationBuilder> opLambda) {
setVirtualHost_Terms("virtualHost", opLambda, null);
}
public void setVirtualHost_Terms(ConditionOptionCall<TermsAggregationBuilder> opLambda, OperatorCall<BsKeyMatchCA> aggsLambda) {
setVirtualHost_Terms("virtualHost", opLambda, aggsLambda);
}
public void setVirtualHost_Terms(String name, ConditionOptionCall<TermsAggregationBuilder> opLambda,
OperatorCall<BsKeyMatchCA> aggsLambda) {
TermsAggregationBuilder builder = regTermsA(name, "virtualHost");
if (opLambda != null) {
opLambda.callback(builder);
}
if (aggsLambda != null) {
KeyMatchCA ca = new KeyMatchCA();
aggsLambda.callback(ca);
ca.getAggregationBuilderList().forEach(builder::subAggregation);
}
}
public void setVirtualHost_SignificantTerms() {
setVirtualHost_SignificantTerms(null);
}
public void setVirtualHost_SignificantTerms(ConditionOptionCall<SignificantTermsAggregationBuilder> opLambda) {
setVirtualHost_SignificantTerms("virtualHost", opLambda, null);
}
public void setVirtualHost_SignificantTerms(ConditionOptionCall<SignificantTermsAggregationBuilder> opLambda,
OperatorCall<BsKeyMatchCA> aggsLambda) {
setVirtualHost_SignificantTerms("virtualHost", opLambda, aggsLambda);
}
public void setVirtualHost_SignificantTerms(String name, ConditionOptionCall<SignificantTermsAggregationBuilder> opLambda,
OperatorCall<BsKeyMatchCA> aggsLambda) {
SignificantTermsAggregationBuilder builder = regSignificantTermsA(name, "virtualHost");
if (opLambda != null) {
opLambda.callback(builder);
}
if (aggsLambda != null) {
KeyMatchCA ca = new KeyMatchCA();
aggsLambda.callback(ca);
ca.getAggregationBuilderList().forEach(builder::subAggregation);
}
}
public void setVirtualHost_IpRange() {
setVirtualHost_IpRange(null);
}
public void setVirtualHost_IpRange(ConditionOptionCall<IpRangeAggregationBuilder> opLambda) {
setVirtualHost_IpRange("virtualHost", opLambda, null);
}
public void setVirtualHost_IpRange(ConditionOptionCall<IpRangeAggregationBuilder> opLambda, OperatorCall<BsKeyMatchCA> aggsLambda) {
setVirtualHost_IpRange("virtualHost", opLambda, aggsLambda);
}
public void setVirtualHost_IpRange(String name, ConditionOptionCall<IpRangeAggregationBuilder> opLambda,
OperatorCall<BsKeyMatchCA> aggsLambda) {
IpRangeAggregationBuilder builder = regIpRangeA(name, "virtualHost");
if (opLambda != null) {
opLambda.callback(builder);
}
if (aggsLambda != null) {
KeyMatchCA ca = new KeyMatchCA();
aggsLambda.callback(ca);
ca.getAggregationBuilderList().forEach(builder::subAggregation);
}
}
public void setVirtualHost_Count() {
setVirtualHost_Count(null);
}
public void setVirtualHost_Count(ConditionOptionCall<ValueCountAggregationBuilder> opLambda) {
setVirtualHost_Count("virtualHost", opLambda);
}
public void setVirtualHost_Count(String name, ConditionOptionCall<ValueCountAggregationBuilder> opLambda) {
ValueCountAggregationBuilder builder = regCountA(name, "virtualHost");
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_Cardinality() {
setVirtualHost_Cardinality(null);
}
public void setVirtualHost_Cardinality(ConditionOptionCall<CardinalityAggregationBuilder> opLambda) {
setVirtualHost_Cardinality("virtualHost", opLambda);
}
public void setVirtualHost_Cardinality(String name, ConditionOptionCall<CardinalityAggregationBuilder> opLambda) {
CardinalityAggregationBuilder builder = regCardinalityA(name, "virtualHost");
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_Missing() {
setVirtualHost_Missing(null);
}
public void setVirtualHost_Missing(ConditionOptionCall<MissingAggregationBuilder> opLambda) {
setVirtualHost_Missing("virtualHost", opLambda, null);
}
public void setVirtualHost_Missing(ConditionOptionCall<MissingAggregationBuilder> opLambda, OperatorCall<BsKeyMatchCA> aggsLambda) {
setVirtualHost_Missing("virtualHost", opLambda, aggsLambda);
}
public void setVirtualHost_Missing(String name, ConditionOptionCall<MissingAggregationBuilder> opLambda,
OperatorCall<BsKeyMatchCA> aggsLambda) {
MissingAggregationBuilder builder = regMissingA(name, "virtualHost");
if (opLambda != null) {
opLambda.callback(builder);
}
if (aggsLambda != null) {
KeyMatchCA ca = new KeyMatchCA();
aggsLambda.callback(ca);
ca.getAggregationBuilderList().forEach(builder::subAggregation);
}
}
public void setUpdatedBy_Terms() {
setUpdatedBy_Terms(null);
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,24 @@
/*
* Copyright 2012-2017 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.BsRelatedContentCQ;
/**
* @author ESFlute (using FreeGen)
*/
public class RelatedContentCQ extends BsRelatedContentCQ {
}

View file

@ -0,0 +1,24 @@
/*
* Copyright 2012-2017 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.BsRelatedQueryCQ;
/**
* @author ESFlute (using FreeGen)
*/
public class RelatedQueryCQ extends BsRelatedQueryCQ {
}

View file

@ -1385,6 +1385,228 @@ public abstract class BsKeyMatchCQ extends EsAbstractConditionQuery {
return this;
}
public void setVirtualHost_Equal(String virtualHost) {
setVirtualHost_Term(virtualHost, null);
}
public void setVirtualHost_Equal(String virtualHost, ConditionOptionCall<TermQueryBuilder> opLambda) {
setVirtualHost_Term(virtualHost, opLambda);
}
public void setVirtualHost_Term(String virtualHost) {
setVirtualHost_Term(virtualHost, null);
}
public void setVirtualHost_Term(String virtualHost, ConditionOptionCall<TermQueryBuilder> opLambda) {
TermQueryBuilder builder = regTermQ("virtualHost", virtualHost);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_NotEqual(String virtualHost) {
setVirtualHost_NotTerm(virtualHost, null);
}
public void setVirtualHost_NotTerm(String virtualHost) {
setVirtualHost_NotTerm(virtualHost, null);
}
public void setVirtualHost_NotEqual(String virtualHost, ConditionOptionCall<BoolQueryBuilder> opLambda) {
setVirtualHost_NotTerm(virtualHost, opLambda);
}
public void setVirtualHost_NotTerm(String virtualHost, ConditionOptionCall<BoolQueryBuilder> opLambda) {
not(not -> not.setVirtualHost_Term(virtualHost), opLambda);
}
public void setVirtualHost_Terms(Collection<String> virtualHostList) {
setVirtualHost_Terms(virtualHostList, null);
}
public void setVirtualHost_Terms(Collection<String> virtualHostList, ConditionOptionCall<TermsQueryBuilder> opLambda) {
TermsQueryBuilder builder = regTermsQ("virtualHost", virtualHostList);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_InScope(Collection<String> virtualHostList) {
setVirtualHost_Terms(virtualHostList, null);
}
public void setVirtualHost_InScope(Collection<String> virtualHostList, ConditionOptionCall<TermsQueryBuilder> opLambda) {
setVirtualHost_Terms(virtualHostList, opLambda);
}
public void setVirtualHost_Match(String virtualHost) {
setVirtualHost_Match(virtualHost, null);
}
public void setVirtualHost_Match(String virtualHost, ConditionOptionCall<MatchQueryBuilder> opLambda) {
MatchQueryBuilder builder = regMatchQ("virtualHost", virtualHost);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_MatchPhrase(String virtualHost) {
setVirtualHost_MatchPhrase(virtualHost, null);
}
public void setVirtualHost_MatchPhrase(String virtualHost, ConditionOptionCall<MatchPhraseQueryBuilder> opLambda) {
MatchPhraseQueryBuilder builder = regMatchPhraseQ("virtualHost", virtualHost);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_MatchPhrasePrefix(String virtualHost) {
setVirtualHost_MatchPhrasePrefix(virtualHost, null);
}
public void setVirtualHost_MatchPhrasePrefix(String virtualHost, ConditionOptionCall<MatchPhrasePrefixQueryBuilder> opLambda) {
MatchPhrasePrefixQueryBuilder builder = regMatchPhrasePrefixQ("virtualHost", virtualHost);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_Fuzzy(String virtualHost) {
setVirtualHost_Fuzzy(virtualHost, null);
}
public void setVirtualHost_Fuzzy(String virtualHost, ConditionOptionCall<MatchQueryBuilder> opLambda) {
MatchQueryBuilder builder = regFuzzyQ("virtualHost", virtualHost);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_Prefix(String virtualHost) {
setVirtualHost_Prefix(virtualHost, null);
}
public void setVirtualHost_Prefix(String virtualHost, ConditionOptionCall<PrefixQueryBuilder> opLambda) {
PrefixQueryBuilder builder = regPrefixQ("virtualHost", virtualHost);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_Wildcard(String virtualHost) {
setVirtualHost_Wildcard(virtualHost, null);
}
public void setVirtualHost_Wildcard(String virtualHost, ConditionOptionCall<WildcardQueryBuilder> opLambda) {
WildcardQueryBuilder builder = regWildcardQ("virtualHost", virtualHost);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_Regexp(String virtualHost) {
setVirtualHost_Regexp(virtualHost, null);
}
public void setVirtualHost_Regexp(String virtualHost, ConditionOptionCall<RegexpQueryBuilder> opLambda) {
RegexpQueryBuilder builder = regRegexpQ("virtualHost", virtualHost);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_SpanTerm(String virtualHost) {
setVirtualHost_SpanTerm("virtualHost", null);
}
public void setVirtualHost_SpanTerm(String virtualHost, ConditionOptionCall<SpanTermQueryBuilder> opLambda) {
SpanTermQueryBuilder builder = regSpanTermQ("virtualHost", virtualHost);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_GreaterThan(String virtualHost) {
setVirtualHost_GreaterThan(virtualHost, null);
}
public void setVirtualHost_GreaterThan(String virtualHost, ConditionOptionCall<RangeQueryBuilder> opLambda) {
final Object _value = virtualHost;
RangeQueryBuilder builder = regRangeQ("virtualHost", ConditionKey.CK_GREATER_THAN, _value);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_LessThan(String virtualHost) {
setVirtualHost_LessThan(virtualHost, null);
}
public void setVirtualHost_LessThan(String virtualHost, ConditionOptionCall<RangeQueryBuilder> opLambda) {
final Object _value = virtualHost;
RangeQueryBuilder builder = regRangeQ("virtualHost", ConditionKey.CK_LESS_THAN, _value);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_GreaterEqual(String virtualHost) {
setVirtualHost_GreaterEqual(virtualHost, null);
}
public void setVirtualHost_GreaterEqual(String virtualHost, ConditionOptionCall<RangeQueryBuilder> opLambda) {
final Object _value = virtualHost;
RangeQueryBuilder builder = regRangeQ("virtualHost", ConditionKey.CK_GREATER_EQUAL, _value);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_LessEqual(String virtualHost) {
setVirtualHost_LessEqual(virtualHost, null);
}
public void setVirtualHost_LessEqual(String virtualHost, ConditionOptionCall<RangeQueryBuilder> opLambda) {
final Object _value = virtualHost;
RangeQueryBuilder builder = regRangeQ("virtualHost", ConditionKey.CK_LESS_EQUAL, _value);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_Exists() {
setVirtualHost_Exists(null);
}
public void setVirtualHost_Exists(ConditionOptionCall<ExistsQueryBuilder> opLambda) {
ExistsQueryBuilder builder = regExistsQ("virtualHost");
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setVirtualHost_CommonTerms(String virtualHost) {
setVirtualHost_CommonTerms(virtualHost, null);
}
public void setVirtualHost_CommonTerms(String virtualHost, ConditionOptionCall<CommonTermsQueryBuilder> opLambda) {
CommonTermsQueryBuilder builder = regCommonTermsQ("virtualHost", virtualHost);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public BsKeyMatchCQ addOrderBy_VirtualHost_Asc() {
regOBA("virtualHost");
return this;
}
public BsKeyMatchCQ addOrderBy_VirtualHost_Desc() {
regOBD("virtualHost");
return this;
}
public void setUpdatedBy_Equal(String updatedBy) {
setUpdatedBy_Term(updatedBy, null);
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,25 @@
/*
* Copyright 2012-2017 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.BsRelatedContentBhv;
/**
* @author FreeGen
*/
public class RelatedContentBhv extends BsRelatedContentBhv {
}

View file

@ -0,0 +1,25 @@
/*
* Copyright 2012-2017 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.BsRelatedQueryBhv;
/**
* @author FreeGen
*/
public class RelatedQueryBhv extends BsRelatedQueryBhv {
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2012-2017 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.BsRelatedContent;
/**
* @author ESFlute (using FreeGen)
*/
public class RelatedContent extends BsRelatedContent {
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);
}
@Override
public String toString() {
return "RelatedContent [createdBy=" + createdBy + ", createdTime=" + createdTime + ", updatedBy=" + updatedBy + ", updatedTime="
+ updatedTime + ", term=" + term + ", content=" + content + "]";
}
}

View file

@ -0,0 +1,50 @@
/*
* Copyright 2012-2017 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 java.util.Arrays;
import org.codelibs.fess.es.config.bsentity.BsRelatedQuery;
/**
* @author ESFlute (using FreeGen)
*/
public class RelatedQuery extends BsRelatedQuery {
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);
}
@Override
public String toString() {
return "RelatedQuery [createdBy=" + createdBy + ", createdTime=" + createdTime + ", updatedBy=" + updatedBy + ", updatedTime="
+ updatedTime + ", term=" + term + ", queries=" + Arrays.toString(queries) + "]";
}
}

View file

@ -76,6 +76,7 @@ public abstract class BsSearchFieldLogBhv extends EsAbstractBehavior<SearchField
result.setName(DfTypeUtil.toString(source.get("name")));
result.setSearchLogId(DfTypeUtil.toString(source.get("searchLogId")));
result.setValue(DfTypeUtil.toString(source.get("value")));
result.setRequestedAt(toLocalDateTime(source.get("requestedAt")));
return updateEntity(source, result);
} catch (InstantiationException | IllegalAccessException e) {
final String msg = "Cannot create a new instance: " + entityType.getName();

View file

@ -46,6 +46,9 @@ public class BsSearchFieldLog extends EsAbstractEntity {
/** value */
protected String value;
/** requestedAt */
protected LocalDateTime requestedAt;
// [Referrers] *comment only
// ===================================================================================
@ -76,6 +79,9 @@ public class BsSearchFieldLog extends EsAbstractEntity {
if (value != null) {
addFieldToSource(sourceMap, "value", value);
}
if (requestedAt != null) {
addFieldToSource(sourceMap, "requestedAt", requestedAt);
}
return sourceMap;
}
@ -92,6 +98,7 @@ public class BsSearchFieldLog extends EsAbstractEntity {
sb.append(dm).append(name);
sb.append(dm).append(searchLogId);
sb.append(dm).append(value);
sb.append(dm).append(requestedAt);
if (sb.length() > dm.length()) {
sb.delete(0, dm.length());
}
@ -131,4 +138,14 @@ public class BsSearchFieldLog extends EsAbstractEntity {
registerModifiedProperty("value");
this.value = value;
}
public LocalDateTime getRequestedAt() {
checkSpecifiedProperty("requestedAt");
return requestedAt;
}
public void setRequestedAt(LocalDateTime value) {
registerModifiedProperty("requestedAt");
this.requestedAt = value;
}
}

View file

@ -84,6 +84,8 @@ public class SearchFieldLogDbm extends AbstractDBMeta {
(et, vl) -> ((SearchFieldLog) et).setSearchLogId(DfTypeUtil.toString(vl)), "searchLogId");
setupEpg(_epgMap, et -> ((SearchFieldLog) et).getValue(), (et, vl) -> ((SearchFieldLog) et).setValue(DfTypeUtil.toString(vl)),
"value");
setupEpg(_epgMap, et -> ((SearchFieldLog) et).getRequestedAt(),
(et, vl) -> ((SearchFieldLog) et).setRequestedAt(DfTypeUtil.toLocalDateTime(vl)), "requestedAt");
}
@Override
@ -126,6 +128,8 @@ public class SearchFieldLogDbm extends AbstractDBMeta {
false, false, "keyword", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnValue = cci("value", "value", null, null, String.class, "value", null, false, false, false,
"keyword", 0, 0, null, false, null, null, null, null, null, false);
protected final ColumnInfo _columnRequestedAt = cci("requestedAt", "requestedAt", null, null, LocalDateTime.class, "requestedAt", null,
false, false, false, "LocalDateTime", 0, 0, null, false, null, null, null, null, null, false);
public ColumnInfo columnName() {
return _columnName;
@ -139,11 +143,16 @@ public class SearchFieldLogDbm extends AbstractDBMeta {
return _columnValue;
}
public ColumnInfo columnRequestedAt() {
return _columnRequestedAt;
}
protected List<ColumnInfo> ccil() {
List<ColumnInfo> ls = newArrayList();
ls.add(columnName());
ls.add(columnSearchLogId());
ls.add(columnValue());
ls.add(columnRequestedAt());
return ls;
}

View file

@ -187,5 +187,9 @@ public class BsSearchFieldLogCB extends EsAbstractConditionBean {
public void columnValue() {
doColumn("value");
}
public void columnRequestedAt() {
doColumn("requestedAt");
}
}
}

View file

@ -22,7 +22,9 @@ import org.codelibs.fess.es.log.cbean.cq.SearchFieldLogCQ;
import org.codelibs.fess.es.log.cbean.cq.bs.BsSearchFieldLogCQ;
import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.global.GlobalAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.missing.MissingAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.range.date.DateRangeAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.range.ip.IpRangeAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsAggregationBuilder;
@ -489,4 +491,111 @@ public abstract class BsSearchFieldLogCA extends EsAbstractConditionAggregation
}
}
public void setRequestedAt_DateRange() {
setRequestedAt_DateRange(null);
}
public void setRequestedAt_DateRange(ConditionOptionCall<DateRangeAggregationBuilder> opLambda) {
setRequestedAt_DateRange("requestedAt", opLambda, null);
}
public void setRequestedAt_DateRange(ConditionOptionCall<DateRangeAggregationBuilder> opLambda,
OperatorCall<BsSearchFieldLogCA> aggsLambda) {
setRequestedAt_DateRange("requestedAt", opLambda, aggsLambda);
}
public void setRequestedAt_DateRange(String name, ConditionOptionCall<DateRangeAggregationBuilder> opLambda,
OperatorCall<BsSearchFieldLogCA> aggsLambda) {
DateRangeAggregationBuilder builder = regDateRangeA(name, "requestedAt");
if (opLambda != null) {
opLambda.callback(builder);
}
if (aggsLambda != null) {
SearchFieldLogCA ca = new SearchFieldLogCA();
aggsLambda.callback(ca);
ca.getAggregationBuilderList().forEach(builder::subAggregation);
}
}
public void setRequestedAt_DateHistogram() {
setRequestedAt_DateHistogram(null);
}
public void setRequestedAt_DateHistogram(ConditionOptionCall<DateHistogramAggregationBuilder> opLambda) {
setRequestedAt_DateHistogram("requestedAt", opLambda, null);
}
public void setRequestedAt_DateHistogram(ConditionOptionCall<DateHistogramAggregationBuilder> opLambda,
OperatorCall<BsSearchFieldLogCA> aggsLambda) {
setRequestedAt_DateHistogram("requestedAt", opLambda, aggsLambda);
}
public void setRequestedAt_DateHistogram(String name, ConditionOptionCall<DateHistogramAggregationBuilder> opLambda,
OperatorCall<BsSearchFieldLogCA> aggsLambda) {
DateHistogramAggregationBuilder builder = regDateHistogramA(name, "requestedAt");
if (opLambda != null) {
opLambda.callback(builder);
}
if (aggsLambda != null) {
SearchFieldLogCA ca = new SearchFieldLogCA();
aggsLambda.callback(ca);
ca.getAggregationBuilderList().forEach(builder::subAggregation);
}
}
public void setRequestedAt_Count() {
setRequestedAt_Count(null);
}
public void setRequestedAt_Count(ConditionOptionCall<ValueCountAggregationBuilder> opLambda) {
setRequestedAt_Count("requestedAt", opLambda);
}
public void setRequestedAt_Count(String name, ConditionOptionCall<ValueCountAggregationBuilder> opLambda) {
ValueCountAggregationBuilder builder = regCountA(name, "requestedAt");
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_Cardinality() {
setRequestedAt_Cardinality(null);
}
public void setRequestedAt_Cardinality(ConditionOptionCall<CardinalityAggregationBuilder> opLambda) {
setRequestedAt_Cardinality("requestedAt", opLambda);
}
public void setRequestedAt_Cardinality(String name, ConditionOptionCall<CardinalityAggregationBuilder> opLambda) {
CardinalityAggregationBuilder builder = regCardinalityA(name, "requestedAt");
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_Missing() {
setRequestedAt_Missing(null);
}
public void setRequestedAt_Missing(ConditionOptionCall<MissingAggregationBuilder> opLambda) {
setRequestedAt_Missing("requestedAt", opLambda, null);
}
public void setRequestedAt_Missing(ConditionOptionCall<MissingAggregationBuilder> opLambda, OperatorCall<BsSearchFieldLogCA> aggsLambda) {
setRequestedAt_Missing("requestedAt", opLambda, aggsLambda);
}
public void setRequestedAt_Missing(String name, ConditionOptionCall<MissingAggregationBuilder> opLambda,
OperatorCall<BsSearchFieldLogCA> aggsLambda) {
MissingAggregationBuilder builder = regMissingA(name, "requestedAt");
if (opLambda != null) {
opLambda.callback(builder);
}
if (aggsLambda != null) {
SearchFieldLogCA ca = new SearchFieldLogCA();
aggsLambda.callback(ca);
ca.getAggregationBuilderList().forEach(builder::subAggregation);
}
}
}

View file

@ -852,4 +852,182 @@ public abstract class BsSearchFieldLogCQ extends EsAbstractConditionQuery {
return this;
}
public void setRequestedAt_Equal(LocalDateTime requestedAt) {
setRequestedAt_Term(requestedAt, null);
}
public void setRequestedAt_Equal(LocalDateTime requestedAt, ConditionOptionCall<TermQueryBuilder> opLambda) {
setRequestedAt_Term(requestedAt, opLambda);
}
public void setRequestedAt_Term(LocalDateTime requestedAt) {
setRequestedAt_Term(requestedAt, null);
}
public void setRequestedAt_Term(LocalDateTime requestedAt, ConditionOptionCall<TermQueryBuilder> opLambda) {
TermQueryBuilder builder = regTermQ("requestedAt", requestedAt);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_NotEqual(LocalDateTime requestedAt) {
setRequestedAt_NotTerm(requestedAt, null);
}
public void setRequestedAt_NotTerm(LocalDateTime requestedAt) {
setRequestedAt_NotTerm(requestedAt, null);
}
public void setRequestedAt_NotEqual(LocalDateTime requestedAt, ConditionOptionCall<BoolQueryBuilder> opLambda) {
setRequestedAt_NotTerm(requestedAt, opLambda);
}
public void setRequestedAt_NotTerm(LocalDateTime requestedAt, ConditionOptionCall<BoolQueryBuilder> opLambda) {
not(not -> not.setRequestedAt_Term(requestedAt), opLambda);
}
public void setRequestedAt_Terms(Collection<LocalDateTime> requestedAtList) {
setRequestedAt_Terms(requestedAtList, null);
}
public void setRequestedAt_Terms(Collection<LocalDateTime> requestedAtList, ConditionOptionCall<TermsQueryBuilder> opLambda) {
TermsQueryBuilder builder = regTermsQ("requestedAt", requestedAtList);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_InScope(Collection<LocalDateTime> requestedAtList) {
setRequestedAt_Terms(requestedAtList, null);
}
public void setRequestedAt_InScope(Collection<LocalDateTime> requestedAtList, ConditionOptionCall<TermsQueryBuilder> opLambda) {
setRequestedAt_Terms(requestedAtList, opLambda);
}
public void setRequestedAt_Match(LocalDateTime requestedAt) {
setRequestedAt_Match(requestedAt, null);
}
public void setRequestedAt_Match(LocalDateTime requestedAt, ConditionOptionCall<MatchQueryBuilder> opLambda) {
MatchQueryBuilder builder = regMatchQ("requestedAt", requestedAt);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_MatchPhrase(LocalDateTime requestedAt) {
setRequestedAt_MatchPhrase(requestedAt, null);
}
public void setRequestedAt_MatchPhrase(LocalDateTime requestedAt, ConditionOptionCall<MatchPhraseQueryBuilder> opLambda) {
MatchPhraseQueryBuilder builder = regMatchPhraseQ("requestedAt", requestedAt);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_MatchPhrasePrefix(LocalDateTime requestedAt) {
setRequestedAt_MatchPhrasePrefix(requestedAt, null);
}
public void setRequestedAt_MatchPhrasePrefix(LocalDateTime requestedAt, ConditionOptionCall<MatchPhrasePrefixQueryBuilder> opLambda) {
MatchPhrasePrefixQueryBuilder builder = regMatchPhrasePrefixQ("requestedAt", requestedAt);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_Fuzzy(LocalDateTime requestedAt) {
setRequestedAt_Fuzzy(requestedAt, null);
}
public void setRequestedAt_Fuzzy(LocalDateTime requestedAt, ConditionOptionCall<MatchQueryBuilder> opLambda) {
MatchQueryBuilder builder = regFuzzyQ("requestedAt", requestedAt);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_GreaterThan(LocalDateTime requestedAt) {
setRequestedAt_GreaterThan(requestedAt, null);
}
public void setRequestedAt_GreaterThan(LocalDateTime requestedAt, ConditionOptionCall<RangeQueryBuilder> opLambda) {
final Object _value = toRangeLocalDateTimeString(requestedAt, "date_optional_time");
RangeQueryBuilder builder = regRangeQ("requestedAt", ConditionKey.CK_GREATER_THAN, _value);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_LessThan(LocalDateTime requestedAt) {
setRequestedAt_LessThan(requestedAt, null);
}
public void setRequestedAt_LessThan(LocalDateTime requestedAt, ConditionOptionCall<RangeQueryBuilder> opLambda) {
final Object _value = toRangeLocalDateTimeString(requestedAt, "date_optional_time");
RangeQueryBuilder builder = regRangeQ("requestedAt", ConditionKey.CK_LESS_THAN, _value);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_GreaterEqual(LocalDateTime requestedAt) {
setRequestedAt_GreaterEqual(requestedAt, null);
}
public void setRequestedAt_GreaterEqual(LocalDateTime requestedAt, ConditionOptionCall<RangeQueryBuilder> opLambda) {
final Object _value = toRangeLocalDateTimeString(requestedAt, "date_optional_time");
RangeQueryBuilder builder = regRangeQ("requestedAt", ConditionKey.CK_GREATER_EQUAL, _value);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_LessEqual(LocalDateTime requestedAt) {
setRequestedAt_LessEqual(requestedAt, null);
}
public void setRequestedAt_LessEqual(LocalDateTime requestedAt, ConditionOptionCall<RangeQueryBuilder> opLambda) {
final Object _value = toRangeLocalDateTimeString(requestedAt, "date_optional_time");
RangeQueryBuilder builder = regRangeQ("requestedAt", ConditionKey.CK_LESS_EQUAL, _value);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_Exists() {
setRequestedAt_Exists(null);
}
public void setRequestedAt_Exists(ConditionOptionCall<ExistsQueryBuilder> opLambda) {
ExistsQueryBuilder builder = regExistsQ("requestedAt");
if (opLambda != null) {
opLambda.callback(builder);
}
}
public void setRequestedAt_CommonTerms(LocalDateTime requestedAt) {
setRequestedAt_CommonTerms(requestedAt, null);
}
public void setRequestedAt_CommonTerms(LocalDateTime requestedAt, ConditionOptionCall<CommonTermsQueryBuilder> opLambda) {
CommonTermsQueryBuilder builder = regCommonTermsQ("requestedAt", requestedAt);
if (opLambda != null) {
opLambda.callback(builder);
}
}
public BsSearchFieldLogCQ addOrderBy_RequestedAt_Asc() {
regOBA("requestedAt");
return this;
}
public BsSearchFieldLogCQ addOrderBy_RequestedAt_Desc() {
regOBD("requestedAt");
return this;
}
}

View file

@ -70,6 +70,7 @@ public class SearchLog extends BsSearchLog {
final SearchFieldLog fieldLog = new SearchFieldLog();
fieldLog.setName(name);
fieldLog.setValue(value);
fieldLog.setRequestedAt(getRequestedAt());
if (searchFieldLogList == null) {
searchFieldLogList = new ArrayList<>();
}

View file

@ -25,10 +25,10 @@ import javax.annotation.PostConstruct;
import org.codelibs.core.misc.Pair;
import org.codelibs.fess.Constants;
import org.codelibs.fess.app.service.KeyMatchService;
import org.codelibs.fess.entity.SearchRequestParams.SearchRequestType;
import org.codelibs.fess.es.client.FessEsClient;
import org.codelibs.fess.es.client.FessEsClient.SearchConditionBuilder;
import org.codelibs.fess.es.config.exbhv.KeyMatchBhv;
import org.codelibs.fess.es.config.exentity.KeyMatch;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.codelibs.fess.util.ComponentUtil;
@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory;
public class KeyMatchHelper {
private static final Logger logger = LoggerFactory.getLogger(KeyMatchHelper.class);
protected volatile Map<String, Pair<QueryBuilder, ScoreFunctionBuilder>> keyMatchQueryMap = Collections.emptyMap();
protected volatile Map<String, Map<String, Pair<QueryBuilder, ScoreFunctionBuilder<?>>>> keyMatchQueryMap = Collections.emptyMap();
protected long reloadInterval = 1000L;
@ -58,53 +58,58 @@ public class KeyMatchHelper {
new Thread(() -> reload(reloadInterval)).start();
}
public List<KeyMatch> getAvailableKeyMatchList() {
return ComponentUtil.getComponent(KeyMatchBhv.class).selectList(cb -> {
cb.query().matchAll();
cb.fetchFirst(ComponentUtil.getFessConfig().getPageKeymatchMaxFetchSizeAsInteger());
});
}
protected void reload(final long interval) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final KeyMatchService keyMatchService = ComponentUtil.getComponent(KeyMatchService.class);
final Map<String, Pair<QueryBuilder, ScoreFunctionBuilder>> keyMatchQueryMap = new HashMap<>();
keyMatchService
.getAvailableKeyMatchList()
.stream()
.forEach(
keyMatch -> {
final BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
getDocumentList(keyMatch).stream().map(doc -> {
return DocumentUtil.getValue(doc, fessConfig.getIndexFieldDocId(), String.class);
}).forEach(docId -> {
boolQuery.should(QueryBuilders.termQuery(fessConfig.getIndexFieldDocId(), docId));
});
final Map<String, Map<String, Pair<QueryBuilder, ScoreFunctionBuilder<?>>>> keyMatchQueryMap = new HashMap<>();
getAvailableKeyMatchList().stream().forEach(
keyMatch -> {
final BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
getDocumentList(keyMatch).stream().map(doc -> {
return DocumentUtil.getValue(doc, fessConfig.getIndexFieldDocId(), String.class);
}).forEach(docId -> {
boolQuery.should(QueryBuilders.termQuery(fessConfig.getIndexFieldDocId(), docId));
});
if (boolQuery.hasClauses()) {
keyMatchQueryMap.put(toLowerCase(keyMatch.getTerm()),
new Pair<>(boolQuery, ScoreFunctionBuilders.weightFactorFunction(keyMatch.getBoost())));
}
if (boolQuery.hasClauses()) {
final String virtualHost = keyMatch.getVirtualHost();
Map<String, Pair<QueryBuilder, ScoreFunctionBuilder<?>>> queryMap = keyMatchQueryMap.get(virtualHost);
if (queryMap == null) {
queryMap = new HashMap<>();
keyMatchQueryMap.put(virtualHost, queryMap);
}
queryMap.put(toLowerCase(keyMatch.getTerm()),
new Pair<>(boolQuery, ScoreFunctionBuilders.weightFactorFunction(keyMatch.getBoost())));
}
if (reloadInterval > 0) {
try {
Thread.sleep(reloadInterval);
} catch (final InterruptedException e) {
if (logger.isDebugEnabled()) {
logger.debug("Interrupted.", e);
}
}
if (interval > 0) {
try {
Thread.sleep(interval);
} catch (final InterruptedException e) {
if (logger.isDebugEnabled()) {
logger.debug("Interrupted.", e);
}
});
}
}
});
this.keyMatchQueryMap = keyMatchQueryMap;
}
protected List<Map<String, Object>> getDocumentList(final KeyMatch keyMatch) {
final FessEsClient fessEsClient = ComponentUtil.getFessEsClient();
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final List<Map<String, Object>> documentList =
fessEsClient.getDocumentList(
fessConfig.getIndexDocumentSearchIndex(),
fessConfig.getIndexDocumentType(),
searchRequestBuilder -> {
return SearchConditionBuilder.builder(searchRequestBuilder.setPreference(Constants.SEARCH_PREFERENCE_PRIMARY))
.searchRequestType(SearchRequestType.ADMIN_SEARCH).size(keyMatch.getMaxSize())
.query(keyMatch.getQuery()).responseFields(new String[] { fessConfig.getIndexFieldDocId() }).build();
});
return documentList;
return fessEsClient.getDocumentList(fessConfig.getIndexDocumentSearchIndex(), fessConfig.getIndexDocumentType(),
searchRequestBuilder -> {
return SearchConditionBuilder.builder(searchRequestBuilder.setPreference(Constants.SEARCH_PREFERENCE_PRIMARY))
.searchRequestType(SearchRequestType.ADMIN_SEARCH).size(keyMatch.getMaxSize()).query(keyMatch.getQuery())
.responseFields(new String[] { fessConfig.getIndexFieldDocId() }).build();
});
}
public long getReloadInterval() {
@ -115,9 +120,18 @@ public class KeyMatchHelper {
this.reloadInterval = reloadInterval;
}
protected Map<String, Pair<QueryBuilder, ScoreFunctionBuilder<?>>> getQueryMap() {
final String key = ComponentUtil.getFessConfig().getVirtualHostValue();
final Map<String, Pair<QueryBuilder, ScoreFunctionBuilder<?>>> map = keyMatchQueryMap.get(key);
if (map != null) {
return map;
}
return Collections.emptyMap();
}
public void buildQuery(final List<String> keywordList, final List<FilterFunctionBuilder> list) {
keywordList.stream().forEach(keyword -> {
final Pair<QueryBuilder, ScoreFunctionBuilder> pair = keyMatchQueryMap.get(toLowerCase(keyword));
final Pair<QueryBuilder, ScoreFunctionBuilder<?>> pair = getQueryMap().get(toLowerCase(keyword));
if (pair != null) {
list.add(new FilterFunctionBuilder(pair.getFirst(), pair.getSecond()));
}
@ -126,7 +140,7 @@ public class KeyMatchHelper {
public List<Map<String, Object>> getBoostedDocumentList(final String term, final int size) {
final FessEsClient fessEsClient = ComponentUtil.getFessEsClient();
final Pair<QueryBuilder, ScoreFunctionBuilder> pair = keyMatchQueryMap.get(toLowerCase(term));
final Pair<QueryBuilder, ScoreFunctionBuilder<?>> pair = getQueryMap().get(toLowerCase(term));
if (pair == null) {
return Collections.emptyList();
}

View file

@ -0,0 +1,90 @@
/*
* Copyright 2012-2017 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.helper;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.codelibs.core.lang.StringUtil;
import org.codelibs.fess.es.config.exbhv.RelatedContentBhv;
import org.codelibs.fess.es.config.exentity.RelatedContent;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.codelibs.fess.util.ComponentUtil;
public class RelatedContentHelper {
protected volatile Map<String, Map<String, String>> relatedContentMap = Collections.emptyMap();
@PostConstruct
public void init() {
reload();
}
public void update() {
reload();
}
public List<RelatedContent> getAvailableRelatedContentList() {
return ComponentUtil.getComponent(RelatedContentBhv.class).selectList(cb -> {
cb.query().matchAll();
cb.query().addOrderBy_Term_Asc();
cb.fetchFirst(ComponentUtil.getFessConfig().getPageRelatedqueryMaxFetchSizeAsInteger());
});
}
protected void reload() {
final Map<String, Map<String, String>> relatedContentMap = new HashMap<>();
getAvailableRelatedContentList().stream().forEach(entity -> {
final String key = getHostKey(entity);
Map<String, String> map = relatedContentMap.get(key);
if (map == null) {
map = new HashMap<>();
relatedContentMap.put(key, map);
}
map.put(toLowerCase(entity.getTerm()), entity.getContent());
});
this.relatedContentMap = relatedContentMap;
}
protected String getHostKey(RelatedContent entity) {
final String key = entity.getVirtualHost();
return StringUtil.isBlank(key) ? StringUtil.EMPTY : key;
}
public String getRelatedContent(final String query) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final String key = fessConfig.getVirtualHostValue();
Map<String, String> map = relatedContentMap.get(key);
if (map != null) {
final String content = map.get(toLowerCase(query));
if (StringUtil.isNotBlank(content)) {
return content;
}
}
return StringUtil.EMPTY;
}
private String toLowerCase(final String term) {
return term != null ? term.toLowerCase(Locale.ROOT) : term;
}
}

View file

@ -0,0 +1,90 @@
/*
* Copyright 2012-2017 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.helper;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.codelibs.core.lang.StringUtil;
import org.codelibs.fess.es.config.exbhv.RelatedQueryBhv;
import org.codelibs.fess.es.config.exentity.RelatedQuery;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.codelibs.fess.util.ComponentUtil;
public class RelatedQueryHelper {
protected volatile Map<String, Map<String, String[]>> relatedQueryMap = Collections.emptyMap();
@PostConstruct
public void init() {
reload();
}
public void update() {
reload();
}
public List<RelatedQuery> getAvailableRelatedQueryList() {
return ComponentUtil.getComponent(RelatedQueryBhv.class).selectList(cb -> {
cb.query().matchAll();
cb.query().addOrderBy_Term_Asc();
cb.fetchFirst(ComponentUtil.getFessConfig().getPageRelatedqueryMaxFetchSizeAsInteger());
});
}
protected void reload() {
final Map<String, Map<String, String[]>> relatedQueryMap = new HashMap<>();
getAvailableRelatedQueryList().stream().forEach(entity -> {
final String key = getHostKey(entity);
Map<String, String[]> map = relatedQueryMap.get(key);
if (map == null) {
map = new HashMap<>();
relatedQueryMap.put(key, map);
}
map.put(toLowerCase(entity.getTerm()), entity.getQueries());
});
this.relatedQueryMap = relatedQueryMap;
}
protected String getHostKey(RelatedQuery entity) {
final String key = entity.getVirtualHost();
return StringUtil.isBlank(key) ? StringUtil.EMPTY : key;
}
public String[] getRelatedQueries(final String query) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final String key = fessConfig.getVirtualHostValue();
Map<String, String[]> map = relatedQueryMap.get(key);
if (map != null) {
final String[] queries = map.get(toLowerCase(query));
if (queries != null) {
return queries;
}
}
return StringUtil.EMPTY_STRINGS;
}
private String toLowerCase(final String term) {
return term != null ? term.toLowerCase(Locale.ROOT) : term;
}
}

View file

@ -94,8 +94,8 @@ public class SearchLogHelper {
searchLog.setResponseTime(queryResponseList.getExecTime());
searchLog.setQueryTime(queryResponseList.getQueryTime());
searchLog.setSearchWord(StringUtils.abbreviate(query, 1000));
searchLog.setSearchQuery(StringUtils.abbreviate(queryResponseList.getSearchQuery(), 1000));
searchLog.setRequestedAt(requestedTime);
searchLog.setSearchQuery(StringUtils.abbreviate(queryResponseList.getSearchQuery(), 1000));
searchLog.setQueryOffset(pageStart);
searchLog.setQueryPageSize(pageSize);
ComponentUtil.getRequestManager().findUserBean(FessUserBean.class).ifPresent(user -> {

View file

@ -264,6 +264,25 @@ public interface FessHtmlPath {
/** The path of the HTML: /admin/pathmap/admin_pathmap_edit.jsp */
HtmlNext path_AdminPathmap_AdminPathmapEditJsp = new HtmlNext("/admin/pathmap/admin_pathmap_edit.jsp");
/** The path of the HTML: /admin/relatedcontent/admin_relatedcontent.jsp */
HtmlNext path_AdminRelatedcontent_AdminRelatedcontentJsp = new HtmlNext("/admin/relatedcontent/admin_relatedcontent.jsp");
/** The path of the HTML: /admin/relatedcontent/admin_relatedcontent_details.jsp */
HtmlNext path_AdminRelatedcontent_AdminRelatedcontentDetailsJsp =
new HtmlNext("/admin/relatedcontent/admin_relatedcontent_details.jsp");
/** The path of the HTML: /admin/relatedcontent/admin_relatedcontent_edit.jsp */
HtmlNext path_AdminRelatedcontent_AdminRelatedcontentEditJsp = new HtmlNext("/admin/relatedcontent/admin_relatedcontent_edit.jsp");
/** The path of the HTML: /admin/relatedquery/admin_relatedquery.jsp */
HtmlNext path_AdminRelatedquery_AdminRelatedqueryJsp = new HtmlNext("/admin/relatedquery/admin_relatedquery.jsp");
/** The path of the HTML: /admin/relatedquery/admin_relatedquery_details.jsp */
HtmlNext path_AdminRelatedquery_AdminRelatedqueryDetailsJsp = new HtmlNext("/admin/relatedquery/admin_relatedquery_details.jsp");
/** The path of the HTML: /admin/relatedquery/admin_relatedquery_edit.jsp */
HtmlNext path_AdminRelatedquery_AdminRelatedqueryEditJsp = new HtmlNext("/admin/relatedquery/admin_relatedquery_edit.jsp");
/** The path of the HTML: /admin/reqheader/admin_reqheader.jsp */
HtmlNext path_AdminReqheader_AdminReqheaderJsp = new HtmlNext("/admin/reqheader/admin_reqheader.jsp");

View file

@ -575,6 +575,12 @@ public class FessLabels extends UserMessages {
/** The key of the message: Access Token */
public static final String LABELS_menu_access_token = "{labels.menu_access_token}";
/** The key of the message: Related Content */
public static final String LABELS_menu_related_content = "{labels.menu_related_content}";
/** The key of the message: Related Query */
public static final String LABELS_menu_related_query = "{labels.menu_related_query}";
/** The key of the message: Search... */
public static final String LABELS_SIDEBAR_placeholder_search = "{labels.sidebar.placeholder_search}";
@ -611,6 +617,9 @@ public class FessLabels extends UserMessages {
/** The key of the message: Popular Words: */
public static final String LABELS_search_popular_word_word = "{labels.search_popular_word_word}";
/** The key of the message: Related Words: */
public static final String LABELS_search_related_queries = "{labels.search_related_queries}";
/** The key of the message: -- Sort -- */
public static final String LABELS_search_result_select_sort = "{labels.search_result_select_sort}";
@ -1448,6 +1457,9 @@ public class FessLabels extends UserMessages {
/** The key of the message: Key Match */
public static final String LABELS_key_match_title_details = "{labels.key_match_title_details}";
/** The key of the message: Virtual Host */
public static final String LABELS_key_match_virtual_host = "{labels.key_match_virtual_host}";
/** The key of the message: Page Design */
public static final String LABELS_design_configuration = "{labels.design_configuration}";
@ -2280,6 +2292,42 @@ public class FessLabels extends UserMessages {
/** The key of the message: Group */
public static final String LABELS_group_title_details = "{labels.group_title_details}";
/** The key of the message: Related Content */
public static final String LABELS_related_content_configuration = "{labels.related_content_configuration}";
/** The key of the message: Content */
public static final String LABELS_related_content_content = "{labels.related_content_content}";
/** The key of the message: Term */
public static final String LABELS_related_content_list_term = "{labels.related_content_list_term}";
/** The key of the message: Term */
public static final String LABELS_related_content_term = "{labels.related_content_term}";
/** The key of the message: Related Content */
public static final String LABELS_related_content_title_details = "{labels.related_content_title_details}";
/** The key of the message: Virtual Host */
public static final String LABELS_related_content_virtual_host = "{labels.related_content_virtual_host}";
/** The key of the message: Related Query */
public static final String LABELS_related_query_configuration = "{labels.related_query_configuration}";
/** The key of the message: Term */
public static final String LABELS_related_query_list_term = "{labels.related_query_list_term}";
/** The key of the message: Queries */
public static final String LABELS_related_query_queries = "{labels.related_query_queries}";
/** The key of the message: Term */
public static final String LABELS_related_query_term = "{labels.related_query_term}";
/** The key of the message: Related Query */
public static final String LABELS_related_query_title_details = "{labels.related_query_title_details}";
/** The key of the message: Virtual Host */
public static final String LABELS_related_query_virtual_host = "{labels.related_query_virtual_host}";
/** The key of the message: Create */
public static final String LABELS_crud_button_create = "{labels.crud_button_create}";

View file

@ -740,6 +740,12 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. 1000 */
String PAGE_DICTIONARY_MAX_FETCH_SIZE = "page.dictionary.max.fetch.size";
/** The key of the configuration. e.g. 5000 */
String PAGE_RELATEDCONTENT_MAX_FETCH_SIZE = "page.relatedcontent.max.fetch.size";
/** The key of the configuration. e.g. 5000 */
String PAGE_RELATEDQUERY_MAX_FETCH_SIZE = "page.relatedquery.max.fetch.size";
/** The key of the configuration. e.g. 100 */
String PAGE_THUMBNAIL_QUEUE_MAX_FETCH_SIZE = "page.thumbnail.queue.max.fetch.size";
@ -896,6 +902,12 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. keymatch */
String ONLINE_HELP_NAME_KEYMATCH = "online.help.name.keymatch";
/** The key of the configuration. e.g. relatedquery */
String ONLINE_HELP_NAME_RELATEDQUERY = "online.help.name.relatedquery";
/** The key of the configuration. e.g. relatedcontent */
String ONLINE_HELP_NAME_RELATEDCONTENT = "online.help.name.relatedcontent";
/** The key of the configuration. e.g. wizard */
String ONLINE_HELP_NAME_WIZARD = "online.help.name.wizard";
@ -3619,6 +3631,36 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
Integer getPageDictionaryMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.relatedcontent.max.fetch.size'. <br>
* The value is, e.g. 5000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageRelatedcontentMaxFetchSize();
/**
* Get the value for the key 'page.relatedcontent.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 5000 <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 getPageRelatedcontentMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.relatedquery.max.fetch.size'. <br>
* The value is, e.g. 5000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageRelatedqueryMaxFetchSize();
/**
* Get the value for the key 'page.relatedquery.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 5000 <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 getPageRelatedqueryMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.thumbnail.queue.max.fetch.size'. <br>
* The value is, e.g. 100 <br>
@ -4188,6 +4230,20 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
String getOnlineHelpNameKeymatch();
/**
* Get the value for the key 'online.help.name.relatedquery'. <br>
* The value is, e.g. relatedquery <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getOnlineHelpNameRelatedquery();
/**
* Get the value for the key 'online.help.name.relatedcontent'. <br>
* The value is, e.g. relatedcontent <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getOnlineHelpNameRelatedcontent();
/**
* Get the value for the key 'online.help.name.wizard'. <br>
* The value is, e.g. wizard <br>
@ -6415,6 +6471,22 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return getAsInteger(FessConfig.PAGE_DICTIONARY_MAX_FETCH_SIZE);
}
public String getPageRelatedcontentMaxFetchSize() {
return get(FessConfig.PAGE_RELATEDCONTENT_MAX_FETCH_SIZE);
}
public Integer getPageRelatedcontentMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_RELATEDCONTENT_MAX_FETCH_SIZE);
}
public String getPageRelatedqueryMaxFetchSize() {
return get(FessConfig.PAGE_RELATEDQUERY_MAX_FETCH_SIZE);
}
public Integer getPageRelatedqueryMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_RELATEDQUERY_MAX_FETCH_SIZE);
}
public String getPageThumbnailQueueMaxFetchSize() {
return get(FessConfig.PAGE_THUMBNAIL_QUEUE_MAX_FETCH_SIZE);
}
@ -6723,6 +6795,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return get(FessConfig.ONLINE_HELP_NAME_KEYMATCH);
}
public String getOnlineHelpNameRelatedquery() {
return get(FessConfig.ONLINE_HELP_NAME_RELATEDQUERY);
}
public String getOnlineHelpNameRelatedcontent() {
return get(FessConfig.ONLINE_HELP_NAME_RELATEDCONTENT);
}
public String getOnlineHelpNameWizard() {
return get(FessConfig.ONLINE_HELP_NAME_WIZARD);
}
@ -7500,7 +7580,10 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
defaultMap.put(FessConfig.PAGE_ELEVATE_WORD_MAX_FETCH_SIZE, "1000");
defaultMap.put(FessConfig.PAGE_BAD_WORD_MAX_FETCH_SIZE, "1000");
defaultMap.put(FessConfig.PAGE_DICTIONARY_MAX_FETCH_SIZE, "1000");
defaultMap.put(FessConfig.PAGE_RELATEDCONTENT_MAX_FETCH_SIZE, "5000");
defaultMap.put(FessConfig.PAGE_RELATEDQUERY_MAX_FETCH_SIZE, "5000");
defaultMap.put(FessConfig.PAGE_THUMBNAIL_QUEUE_MAX_FETCH_SIZE, "100");
defaultMap.put(FessConfig.PAGE_THUMBNAIL_PURGE_MAX_FETCH_SIZE, "100");
defaultMap.put(FessConfig.PAGING_SEARCH_PAGE_START, "0");
defaultMap.put(FessConfig.PAGING_SEARCH_PAGE_SIZE, "20");
defaultMap.put(FessConfig.PAGING_SEARCH_PAGE_MAX_SIZE, "100");
@ -7551,6 +7634,8 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
defaultMap.put(FessConfig.ONLINE_HELP_NAME_ROLE, "role");
defaultMap.put(FessConfig.ONLINE_HELP_NAME_JOBLOG, "joblog");
defaultMap.put(FessConfig.ONLINE_HELP_NAME_KEYMATCH, "keymatch");
defaultMap.put(FessConfig.ONLINE_HELP_NAME_RELATEDQUERY, "relatedquery");
defaultMap.put(FessConfig.ONLINE_HELP_NAME_RELATEDCONTENT, "relatedcontent");
defaultMap.put(FessConfig.ONLINE_HELP_NAME_WIZARD, "wizard");
defaultMap.put(FessConfig.ONLINE_HELP_NAME_BADWORD, "badword");
defaultMap.put(FessConfig.ONLINE_HELP_NAME_PATHMAP, "pathmap");

View file

@ -34,6 +34,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -68,6 +69,8 @@ import org.lastaflute.web.validation.theme.typed.LongTypeValidator;
public interface FessProp {
public static final String VIRTUAL_HOST_VALUE = "VirtualHostValue";
public static final String QUERY_DEFAULT_LANGUAGES = "queryDefaultLanguages";
public static final String HTML_PROXY = "httpProxy";
@ -1581,8 +1584,20 @@ public interface FessProp {
String getVirtualHostHeaders();
@SuppressWarnings("unchecked")
public default HtmlNext getVirtualHostPath(final HtmlNext page) {
return processVirtualHost(s -> new HtmlNext(s + page.getRoutingPath()), page);
}
public default String getVirtualHostValue() {
return LaRequestUtil.getOptionalRequest().map(req -> (String) req.getAttribute(VIRTUAL_HOST_VALUE)).orElseGet(() -> {
final String value = processVirtualHost(s -> s, StringUtil.EMPTY);
LaRequestUtil.getOptionalRequest().ifPresent(req -> req.setAttribute(VIRTUAL_HOST_VALUE, value));
return value;
});
}
@SuppressWarnings("unchecked")
public default <T> T processVirtualHost(final Function<String, T> func, final T defaultValue) {
Tuple3<String, String, String>[] hosts = (Tuple3<String, String, String>[]) propMap.get(VIRTUAL_HOST_HEADERS);
if (hosts == null) {
hosts = split(getVirtualHostHeaders(), "\n").get(stream -> stream.map(s -> {
@ -1602,11 +1617,11 @@ public interface FessProp {
for (final Tuple3<String, String, String> host : vHosts) {
final String headerValue = req.getHeader(host.getValue1());
if (host.getValue2().equalsIgnoreCase(headerValue)) {
return new HtmlNext(host.getValue3() + page.getRoutingPath());
return func.apply(host.getValue3());
}
}
return page;
}).orElse(page);
return defaultValue;
}).orElse(defaultValue);
}
String getCrawlerFailureUrlStatusCodes();

View file

@ -48,6 +48,8 @@ import org.codelibs.fess.helper.PermissionHelper;
import org.codelibs.fess.helper.PopularWordHelper;
import org.codelibs.fess.helper.ProcessHelper;
import org.codelibs.fess.helper.QueryHelper;
import org.codelibs.fess.helper.RelatedContentHelper;
import org.codelibs.fess.helper.RelatedQueryHelper;
import org.codelibs.fess.helper.RoleQueryHelper;
import org.codelibs.fess.helper.SambaHelper;
import org.codelibs.fess.helper.SearchLogHelper;
@ -393,6 +395,14 @@ public final class ComponentUtil {
return getComponent(CrawlerClientFactory.class);
}
public static RelatedQueryHelper getRelatedQueryHelper() {
return getComponent(RelatedQueryHelper.class);
}
public static RelatedContentHelper getRelatedContentHelper() {
return getComponent(RelatedContentHelper.class);
}
public static <T> T getComponent(final Class<T> clazz) {
try {
return SingletonLaContainer.getComponent(clazz);

View file

@ -20,6 +20,7 @@ import static org.codelibs.core.stream.StreamUtil.stream;
import java.util.Map;
import org.codelibs.core.lang.StringUtil;
import org.codelibs.fess.helper.RelatedQueryHelper;
import org.codelibs.fess.mylasta.direction.FessConfig;
public class QueryStringBuilder {
@ -29,11 +30,30 @@ public class QueryStringBuilder {
private Map<String, String[]> fieldMap;
protected String quote(final String value) {
if (value.split("\\s").length > 1) {
return new StringBuilder().append('"').append(value.replace('"', ' ')).append('"').toString();
}
return value;
}
public String build() {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final StringBuilder queryBuf = new StringBuilder(255);
if (StringUtil.isNotBlank(query)) {
queryBuf.append('(').append(query).append(')');
final RelatedQueryHelper relatedQueryHelper = ComponentUtil.getRelatedQueryHelper();
final String[] relatedQueries = relatedQueryHelper.getRelatedQueries(query);
if (relatedQueries.length == 0) {
queryBuf.append('(').append(query).append(')');
} else {
queryBuf.append('(');
queryBuf.append(quote(query));
for (final String s : relatedQueries) {
queryBuf.append(" OR ");
queryBuf.append(quote(s));
}
queryBuf.append(')');
}
}
stream(extraQueries).of(
stream -> stream.filter(q -> StringUtil.isNotBlank(q) && q.length() <= fessConfig.getQueryMaxLengthAsInteger().intValue())

View file

@ -25,6 +25,10 @@
</component>
<component name="keyMatchHelper" class="org.codelibs.fess.helper.KeyMatchHelper">
</component>
<component name="relatedContentHelper" class="org.codelibs.fess.helper.RelatedContentHelper">
</component>
<component name="relatedQueryHelper" class="org.codelibs.fess.helper.RelatedQueryHelper">
</component>
<component name="queryParser" class="org.apache.lucene.queryparser.ext.ExtendableQueryParser" instance="prototype">
<arg>org.codelibs.fess.Constants.DEFAULT_FIELD</arg>
<arg>

View file

@ -224,6 +224,12 @@
<postConstruct name="addIndexConfig">
<arg>".fess_config/path_mapping"</arg>
</postConstruct>
<postConstruct name="addIndexConfig">
<arg>".fess_config/related_content"</arg>
</postConstruct>
<postConstruct name="addIndexConfig">
<arg>".fess_config/related_query"</arg>
</postConstruct>
<postConstruct name="addIndexConfig">
<arg>".fess_config/request_header"</arg>
</postConstruct>

View file

@ -30,6 +30,8 @@
<component name="labelTypeBhv" class="org.codelibs.fess.es.config.exbhv.LabelTypeBhv"/>
<component name="labelToRoleBhv" class="org.codelibs.fess.es.config.exbhv.LabelToRoleBhv"/>
<component name="pathMappingBhv" class="org.codelibs.fess.es.config.exbhv.PathMappingBhv"/>
<component name="relatedContentBhv" class="org.codelibs.fess.es.config.exbhv.RelatedContentBhv"/>
<component name="relatedQueryBhv" class="org.codelibs.fess.es.config.exbhv.RelatedQueryBhv"/>
<component name="requestHeaderBhv" class="org.codelibs.fess.es.config.exbhv.RequestHeaderBhv"/>
<component name="roleTypeBhv" class="org.codelibs.fess.es.config.exbhv.RoleTypeBhv"/>
<component name="scheduledJobBhv" class="org.codelibs.fess.es.config.exbhv.ScheduledJobBhv"/>

View file

@ -387,6 +387,8 @@ page.search.field.log.max.fetch.size=100
page.elevate.word.max.fetch.size=1000
page.bad.word.max.fetch.size=1000
page.dictionary.max.fetch.size=1000
page.relatedcontent.max.fetch.size=5000
page.relatedquery.max.fetch.size=5000
page.thumbnail.queue.max.fetch.size=100
page.thumbnail.purge.max.fetch.size=100
@ -457,6 +459,8 @@ online.help.name.general=general
online.help.name.role=role
online.help.name.joblog=joblog
online.help.name.keymatch=keymatch
online.help.name.relatedquery=relatedquery
online.help.name.relatedcontent=relatedcontent
online.help.name.wizard=wizard
online.help.name.badword=badword
online.help.name.pathmap=pathmap

View file

@ -19,6 +19,9 @@
"boost": {
"type": "float"
},
"virtualHost": {
"type": "keyword"
},
"createdBy": {
"type": "keyword"
},

View file

@ -0,0 +1,33 @@
{
"related_content": {
"_source": {
"enabled": true
},
"_all": {
"enabled": false
},
"properties": {
"term": {
"type": "keyword"
},
"content": {
"type": "keyword"
},
"virtualHost": {
"type": "keyword"
},
"createdBy": {
"type": "keyword"
},
"createdTime": {
"type": "long"
},
"updatedBy": {
"type": "keyword"
},
"updatedTime": {
"type": "long"
}
}
}
}

View file

@ -0,0 +1,33 @@
{
"related_query": {
"_source": {
"enabled": true
},
"_all": {
"enabled": false
},
"properties": {
"term": {
"type": "keyword"
},
"queries": {
"type": "keyword"
},
"virtualHost": {
"type": "keyword"
},
"createdBy": {
"type": "keyword"
},
"createdTime": {
"type": "long"
},
"updatedBy": {
"type": "keyword"
},
"updatedTime": {
"type": "long"
}
}
}
}

View file

@ -15,6 +15,10 @@
},
"value": {
"type": "keyword"
},
"requestedAt": {
"type": "date",
"format": "date_optional_time"
}
}
}

View file

@ -182,6 +182,8 @@ labels.menu_failure_url=Failure URL
labels.menu_search_list=Search
labels.menu_backup=Back Up
labels.menu_access_token=Access Token
labels.menu_related_content=Related Content
labels.menu_related_query=Related Query
labels.sidebar.placeholder_search=Search...
labels.sidebar.menu=MENU
labels.footer.copyright=&copy;2017 <a href="https://github.com/codelibs">CodeLibs Project</a>.
@ -194,6 +196,7 @@ labels.next_page=Next
labels.did_not_match=Your search - <b>{0}</b> - did not match any documents.
labels.search_title=Fess
labels.search_popular_word_word=Popular Words:
labels.search_related_queries=Related Words:
labels.search_result_select_sort=-- Sort --
labels.search_result_select_num=-- Results per page --
labels.search_result_sort_score_desc=Score
@ -473,6 +476,7 @@ labels.key_match_size=Size
labels.key_match_boost=Boost
labels.key_match_urls=Urls
labels.key_match_title_details=Key Match
labels.key_match_virtual_host=Virtual Host
labels.design_configuration=Page Design
labels.design_title_file_upload=File Upload
labels.design_title_file=File Manager
@ -750,6 +754,18 @@ labels.group_configuration=group
labels.group_list_name=Name
labels.group_name=Name
labels.group_title_details=Group
labels.related_content_configuration=Related Content
labels.related_content_content=Content
labels.related_content_list_term=Term
labels.related_content_term=Term
labels.related_content_title_details=Related Content
labels.related_content_virtual_host=Virtual Host
labels.related_query_configuration=Related Query
labels.related_query_list_term=Term
labels.related_query_queries=Queries
labels.related_query_term=Term
labels.related_query_title_details=Related Query
labels.related_query_virtual_host=Virtual Host
labels.crud_button_create=Create
labels.crud_button_update=Update
labels.crud_button_delete=Delete

View file

@ -182,6 +182,8 @@ labels.menu_failure_url=Failure URL
labels.menu_search_list=Search
labels.menu_backup=Back Up
labels.menu_access_token=Access Token
labels.menu_related_content=Related Content
labels.menu_related_query=Related Query
labels.sidebar.placeholder_search=Search...
labels.sidebar.menu=MENU
labels.footer.copyright=&copy;2017 <a href="https://github.com/codelibs">CodeLibs Project</a>.
@ -194,6 +196,7 @@ labels.next_page=Next
labels.did_not_match=Your search - <b>{0}</b> - did not match any documents.
labels.search_title=Fess
labels.search_popular_word_word=Popular Words:
labels.search_related_queries=Related Words:
labels.search_result_select_sort=-- Sort --
labels.search_result_select_num=-- Results per page --
labels.search_result_sort_score_desc=Score
@ -473,6 +476,7 @@ labels.key_match_size=Size
labels.key_match_boost=Boost
labels.key_match_urls=Urls
labels.key_match_title_details=Key Match
labels.key_match_virtual_host=Virtual Host
labels.design_configuration=Page Design
labels.design_title_file_upload=File Upload
labels.design_title_file=File Manager
@ -750,6 +754,18 @@ labels.group_configuration=group
labels.group_list_name=Name
labels.group_name=Name
labels.group_title_details=Group
labels.related_content_configuration=Related Content
labels.related_content_content=Content
labels.related_content_list_term=Term
labels.related_content_term=Term
labels.related_content_title_details=Related Content
labels.related_content_virtual_host=Virtual Host
labels.related_query_configuration=Related Query
labels.related_query_list_term=Term
labels.related_query_queries=Queries
labels.related_query_term=Term
labels.related_query_title_details=Related Query
labels.related_query_virtual_host=Virtual Host
labels.crud_button_create=Create
labels.crud_button_update=Update
labels.crud_button_delete=Delete

View file

@ -175,6 +175,8 @@ labels.menu_failure_url=\u969c\u5bb3URL
labels.menu_search_list=\u691c\u7d22
labels.menu_backup=\u30d0\u30c3\u30af\u30a2\u30c3\u30d7
labels.menu_access_token=\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3
labels.menu_related_content=\u95a2\u9023\u30b3\u30f3\u30c6\u30f3\u30c4
labels.menu_related_query=\u95a2\u9023\u30af\u30a8\u30ea\u30fc
labels.sidebar.placeholder_search=\u691c\u7d22...
labels.sidebar.menu=\u30e1\u30cb\u30e5\u30fc
labels.footer.copyright=&copy;2017 <a href="https://github.com/codelibs">CodeLibs Project</a>.
@ -187,6 +189,7 @@ labels.next_page=\u6b21\u3078
labels.did_not_match=<b>{0}</b> \u306b\u4e00\u81f4\u3059\u308b\u60c5\u5831\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002
labels.search_title=Fess
labels.search_popular_word_word=\u4eba\u6c17\u30ef\u30fc\u30c9:
labels.search_related_queries=\u95a2\u9023\u30ef\u30fc\u30c9:
labels.search_result_select_sort=- \u30bd\u30fc\u30c8 -
labels.search_result_select_num=- \u8868\u793a\u4ef6\u6570 -
labels.search_result_sort_score_desc=\u30b9\u30b3\u30a2\u9806
@ -466,6 +469,7 @@ labels.key_match_size=\u30b5\u30a4\u30ba
labels.key_match_boost=\u30d6\u30fc\u30b9\u30c8\u5024
labels.key_match_urls=URL
labels.key_match_title_details=\u30ad\u30fc\u30de\u30c3\u30c1
labels.key_match_virtual_host=\u4eee\u60f3\u30db\u30b9\u30c8
labels.design_configuration=\u30da\u30fc\u30b8\u306e\u30c7\u30b6\u30a4\u30f3
labels.design_title_file_upload=\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb
labels.design_title_file=\u30d5\u30a1\u30a4\u30eb\u30de\u30cd\u30fc\u30b8\u30e3\u30fc
@ -745,6 +749,18 @@ labels.group_configuration=\u30b0\u30eb\u30fc\u30d7
labels.group_list_name=\u540d\u524d
labels.group_name=\u540d\u524d
labels.group_title_details=\u30b0\u30eb\u30fc\u30d7
labels.related_content_configuration=\u95a2\u9023\u30b3\u30f3\u30c6\u30f3\u30c4
labels.related_content_content=\u30b3\u30f3\u30c6\u30f3\u30c4
labels.related_content_list_term=\u691c\u7d22\u8a9e
labels.related_content_term=\u691c\u7d22\u8a9e
labels.related_content_title_details=\u95a2\u9023\u30b3\u30f3\u30c6\u30f3\u30c4
labels.related_content_virtual_host=\u4eee\u60f3\u30db\u30b9\u30c8
labels.related_query_configuration=\u95a2\u9023\u30af\u30a8\u30ea\u30fc
labels.related_query_list_term=\u691c\u7d22\u8a9e
labels.related_query_queries=\u30af\u30a8\u30ea\u30fc
labels.related_query_term=\u691c\u7d22\u8a9e
labels.related_query_title_details=\u95a2\u9023\u30af\u30a8\u30ea\u30fc
labels.related_query_virtual_host=\u4eee\u60f3\u30db\u30b9\u30c8
labels.crud_button_create=\u4f5c\u6210
labels.crud_button_update=\u66f4\u65b0
labels.crud_button_delete=\u524a\u9664

View file

@ -72,6 +72,11 @@
${f:h(doc.url)}<br/>
</c:forEach></td>
</tr>
<tr>
<th class="col-xs-2"><la:message
key="labels.key_match_virtual_host" /></th>
<td>${f:h(virtualHost)}<la:hidden property="virtualHost" /></td>
</tr>
</tbody>
</table>
</div>

View file

@ -78,6 +78,14 @@
<la:text styleId="boost" property="boost" styleClass="form-control" />
</div>
</div>
<div class="form-group">
<label for="virtualHost" class="col-sm-3 control-label"><la:message
key="labels.key_match_virtual_host" /></label>
<div class="col-sm-9">
<la:errors property="virtualHost" />
<la:text styleId="virtualHost" property="virtualHost" styleClass="form-control" />
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">

View file

@ -0,0 +1,86 @@
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><la:message key="labels.admin_brand_title" /> | <la:message
key="labels.related_content_configuration" /></title>
<jsp:include page="/WEB-INF/view/common/admin/head.jsp"></jsp:include>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<jsp:include page="/WEB-INF/view/common/admin/header.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/admin/sidebar.jsp">
<jsp:param name="menuCategoryType" value="crawl" />
<jsp:param name="menuType" value="relatedContent" />
</jsp:include>
<div class="content-wrapper">
<section class="content-header">
<h1>
<la:message key="labels.related_content_configuration" />
</h1>
<jsp:include page="/WEB-INF/view/common/admin/crud/breadcrumb.jsp"></jsp:include>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header with-border">
<jsp:include page="/WEB-INF/view/common/admin/crud/header.jsp"></jsp:include>
</div>
<!-- /.box-header -->
<div class="box-body">
<%-- Message --%>
<div>
<la:info id="msg" message="true">
<div class="alert alert-info">${msg}</div>
</la:info>
<la:errors />
</div>
<%-- List --%>
<c:if test="${relatedContentPager.allRecordCount == 0}">
<div class="row top10">
<div class="col-sm-12">
<i class="fa fa-info-circle text-light-blue"></i>
<la:message key="labels.list_could_not_find_crud_table" />
</div>
</div>
</c:if>
<c:if test="${relatedContentPager.allRecordCount > 0}">
<div class="row">
<div class="col-sm-12">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th><la:message
key="labels.related_content_list_term" /></th>
</tr>
</thead>
<tbody>
<c:forEach var="data" varStatus="s"
items="${relatedContentItems}">
<tr
data-href="${contextPath}/admin/relatedcontent/details/4/${f:u(data.id)}">
<td>${f:h(data.term)}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
<c:set var="pager" value="${relatedContentPager}"
scope="request" />
<c:import url="/WEB-INF/view/common/admin/crud/pagination.jsp" />
</c:if>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
</div>
</section>
</div>
<jsp:include page="/WEB-INF/view/common/admin/footer.jsp"></jsp:include>
</div>
<jsp:include page="/WEB-INF/view/common/admin/foot.jsp"></jsp:include>
</body>
</html>

View file

@ -0,0 +1,87 @@
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><la:message key="labels.admin_brand_title" /> | <la:message
key="labels.related_content_configuration" /></title>
<jsp:include page="/WEB-INF/view/common/admin/head.jsp"></jsp:include>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<jsp:include page="/WEB-INF/view/common/admin/header.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/admin/sidebar.jsp">
<jsp:param name="menuCategoryType" value="crawl" />
<jsp:param name="menuType" value="relatedContent" />
</jsp:include>
<div class="content-wrapper">
<section class="content-header">
<h1>
<la:message key="labels.related_content_title_details" />
</h1>
<jsp:include page="/WEB-INF/view/common/admin/crud/breadcrumb.jsp"></jsp:include>
</section>
<section class="content">
<la:form action="/admin/relatedcontent/">
<la:hidden property="crudMode" />
<c:if test="${crudMode==2 || crudMode==3 || crudMode==4}">
<la:hidden property="id" />
<la:hidden property="versionNo" />
</c:if>
<la:hidden property="createdBy" />
<la:hidden property="createdTime" />
<div class="row">
<div class="col-md-12">
<div
class="box <c:if test="${crudMode == 1}">box-success</c:if><c:if test="${crudMode == 2}">box-warning</c:if><c:if test="${crudMode == 3}">box-danger</c:if><c:if test="${crudMode == 4}">box-primary</c:if>">
<%-- Box Header --%>
<div class="box-header with-border">
<jsp:include page="/WEB-INF/view/common/admin/crud/header.jsp"></jsp:include>
</div>
<%-- Box Body --%>
<div class="box-body">
<%-- Message --%>
<div>
<la:info id="msg" message="true">
<div class="alert alert-info">${msg}</div>
</la:info>
<la:errors />
</div>
<%-- Form Fields --%>
<table class="table table-bordered">
<tbody>
<tr>
<th class="col-xs-2"><la:message
key="labels.related_content_term" /></th>
<td>${f:h(term)}<la:hidden property="term" /></td>
</tr>
<tr>
<th class="col-xs-2"><la:message
key="labels.related_content_content" /></th>
<td>${f:h(content)}<la:hidden property="content" /></td>
</tr>
<tr>
<th class="col-xs-2"><la:message
key="labels.related_content_virtual_host" /></th>
<td>${f:h(virtualHost)}<la:hidden property="virtualHost" /></td>
</tr>
</tbody>
</table>
</div>
<!-- /.box-body -->
<div class="box-footer">
<jsp:include page="/WEB-INF/view/common/admin/crud/buttons.jsp"></jsp:include>
</div>
<!-- /.box-footer -->
</div>
<!-- /.box -->
</div>
</div>
</la:form>
</section>
</div>
<jsp:include page="/WEB-INF/view/common/admin/footer.jsp"></jsp:include>
</div>
<jsp:include page="/WEB-INF/view/common/admin/foot.jsp"></jsp:include>
</body>
</html>

View file

@ -0,0 +1,88 @@
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><la:message key="labels.admin_brand_title" /> | <la:message
key="labels.related_content_configuration" /></title>
<jsp:include page="/WEB-INF/view/common/admin/head.jsp"></jsp:include>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<jsp:include page="/WEB-INF/view/common/admin/header.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/admin/sidebar.jsp">
<jsp:param name="menuCategoryType" value="crawl" />
<jsp:param name="menuType" value="relatedContent" />
</jsp:include>
<div class="content-wrapper">
<section class="content-header">
<h1>
<la:message key="labels.related_content_title_details" />
</h1>
<jsp:include page="/WEB-INF/view/common/admin/crud/breadcrumb.jsp"></jsp:include>
</section>
<section class="content">
<la:form action="/admin/relatedcontent/" styleClass="form-horizontal">
<la:hidden property="crudMode" />
<c:if test="${crudMode==2}">
<la:hidden property="id" />
<la:hidden property="versionNo" />
</c:if>
<la:hidden property="createdBy" />
<la:hidden property="createdTime" />
<div class="row">
<div class="col-md-12">
<div
class="box <c:if test="${crudMode == 1}">box-success</c:if><c:if test="${crudMode == 2}">box-warning</c:if>">
<div class="box-header with-border">
<jsp:include page="/WEB-INF/view/common/admin/crud/header.jsp"></jsp:include>
</div>
<!-- /.box-header -->
<div class="box-body">
<div>
<la:info id="msg" message="true">
<div class="alert alert-info">${msg}</div>
</la:info>
<la:errors property="_global" />
</div>
<div class="form-group">
<label for="term" class="col-sm-3 control-label"><la:message
key="labels.related_content_term" /></label>
<div class="col-sm-9">
<la:errors property="term" />
<la:text styleId="term" property="term" styleClass="form-control" />
</div>
</div>
<div class="form-group">
<label for="content" class="col-sm-3 control-label"><la:message
key="labels.related_content_content" /></label>
<div class="col-sm-9">
<la:errors property="content" />
<la:textarea styleId="content" property="content" styleClass="form-control" rows="5"/>
</div>
</div>
<div class="form-group">
<label for="virtualHost" class="col-sm-3 control-label"><la:message
key="labels.related_query_virtual_host" /></label>
<div class="col-sm-9">
<la:errors property="virtualHost" />
<la:text styleId="virtualHost" property="virtualHost" styleClass="form-control" />
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<jsp:include page="/WEB-INF/view/common/admin/crud/buttons.jsp"></jsp:include>
</div>
<!-- /.box-footer -->
</div>
<!-- /.box -->
</div>
</div>
</la:form>
</section>
</div>
<jsp:include page="/WEB-INF/view/common/admin/footer.jsp"></jsp:include>
</div>
<jsp:include page="/WEB-INF/view/common/admin/foot.jsp"></jsp:include>
</body>
</html>

View file

@ -0,0 +1,86 @@
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><la:message key="labels.admin_brand_title" /> | <la:message
key="labels.related_query_configuration" /></title>
<jsp:include page="/WEB-INF/view/common/admin/head.jsp"></jsp:include>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<jsp:include page="/WEB-INF/view/common/admin/header.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/admin/sidebar.jsp">
<jsp:param name="menuCategoryType" value="crawl" />
<jsp:param name="menuType" value="relatedQuery" />
</jsp:include>
<div class="content-wrapper">
<section class="content-header">
<h1>
<la:message key="labels.related_query_configuration" />
</h1>
<jsp:include page="/WEB-INF/view/common/admin/crud/breadcrumb.jsp"></jsp:include>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header with-border">
<jsp:include page="/WEB-INF/view/common/admin/crud/header.jsp"></jsp:include>
</div>
<!-- /.box-header -->
<div class="box-body">
<%-- Message --%>
<div>
<la:info id="msg" message="true">
<div class="alert alert-info">${msg}</div>
</la:info>
<la:errors />
</div>
<%-- List --%>
<c:if test="${relatedQueryPager.allRecordCount == 0}">
<div class="row top10">
<div class="col-sm-12">
<i class="fa fa-info-circle text-light-blue"></i>
<la:message key="labels.list_could_not_find_crud_table" />
</div>
</div>
</c:if>
<c:if test="${relatedQueryPager.allRecordCount > 0}">
<div class="row">
<div class="col-sm-12">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th><la:message
key="labels.related_query_list_term" /></th>
</tr>
</thead>
<tbody>
<c:forEach var="data" varStatus="s"
items="${relatedQueryItems}">
<tr
data-href="${contextPath}/admin/relatedquery/details/4/${f:u(data.id)}">
<td>${f:h(data.term)}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
<c:set var="pager" value="${relatedQueryPager}"
scope="request" />
<c:import url="/WEB-INF/view/common/admin/crud/pagination.jsp" />
</c:if>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
</div>
</section>
</div>
<jsp:include page="/WEB-INF/view/common/admin/footer.jsp"></jsp:include>
</div>
<jsp:include page="/WEB-INF/view/common/admin/foot.jsp"></jsp:include>
</body>
</html>

View file

@ -0,0 +1,87 @@
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><la:message key="labels.admin_brand_title" /> | <la:message
key="labels.related_query_configuration" /></title>
<jsp:include page="/WEB-INF/view/common/admin/head.jsp"></jsp:include>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<jsp:include page="/WEB-INF/view/common/admin/header.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/admin/sidebar.jsp">
<jsp:param name="menuCategoryType" value="crawl" />
<jsp:param name="menuType" value="relatedQuery" />
</jsp:include>
<div class="content-wrapper">
<section class="content-header">
<h1>
<la:message key="labels.related_query_title_details" />
</h1>
<jsp:include page="/WEB-INF/view/common/admin/crud/breadcrumb.jsp"></jsp:include>
</section>
<section class="content">
<la:form action="/admin/relatedquery/">
<la:hidden property="crudMode" />
<c:if test="${crudMode==2 || crudMode==3 || crudMode==4}">
<la:hidden property="id" />
<la:hidden property="versionNo" />
</c:if>
<la:hidden property="createdBy" />
<la:hidden property="createdTime" />
<div class="row">
<div class="col-md-12">
<div
class="box <c:if test="${crudMode == 1}">box-success</c:if><c:if test="${crudMode == 2}">box-warning</c:if><c:if test="${crudMode == 3}">box-danger</c:if><c:if test="${crudMode == 4}">box-primary</c:if>">
<%-- Box Header --%>
<div class="box-header with-border">
<jsp:include page="/WEB-INF/view/common/admin/crud/header.jsp"></jsp:include>
</div>
<%-- Box Body --%>
<div class="box-body">
<%-- Message --%>
<div>
<la:info id="msg" message="true">
<div class="alert alert-info">${msg}</div>
</la:info>
<la:errors />
</div>
<%-- Form Fields --%>
<table class="table table-bordered">
<tbody>
<tr>
<th class="col-xs-2"><la:message
key="labels.related_query_term" /></th>
<td>${f:h(term)}<la:hidden property="term" /></td>
</tr>
<tr>
<th><la:message
key="labels.related_query_queries" /></th>
<td>${f:h(queries)}<la:hidden property="queries" /></td>
</tr>
<tr>
<th class="col-xs-2"><la:message
key="labels.related_query_virtual_host" /></th>
<td>${f:h(virtualHost)}<la:hidden property="virtualHost" /></td>
</tr>
</tbody>
</table>
</div>
<!-- /.box-body -->
<div class="box-footer">
<jsp:include page="/WEB-INF/view/common/admin/crud/buttons.jsp"></jsp:include>
</div>
<!-- /.box-footer -->
</div>
<!-- /.box -->
</div>
</div>
</la:form>
</section>
</div>
<jsp:include page="/WEB-INF/view/common/admin/footer.jsp"></jsp:include>
</div>
<jsp:include page="/WEB-INF/view/common/admin/foot.jsp"></jsp:include>
</body>
</html>

View file

@ -0,0 +1,88 @@
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><la:message key="labels.admin_brand_title" /> | <la:message
key="labels.related_query_configuration" /></title>
<jsp:include page="/WEB-INF/view/common/admin/head.jsp"></jsp:include>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<jsp:include page="/WEB-INF/view/common/admin/header.jsp"></jsp:include>
<jsp:include page="/WEB-INF/view/common/admin/sidebar.jsp">
<jsp:param name="menuCategoryType" value="crawl" />
<jsp:param name="menuType" value="relatedQuery" />
</jsp:include>
<div class="content-wrapper">
<section class="content-header">
<h1>
<la:message key="labels.related_query_title_details" />
</h1>
<jsp:include page="/WEB-INF/view/common/admin/crud/breadcrumb.jsp"></jsp:include>
</section>
<section class="content">
<la:form action="/admin/relatedquery/" styleClass="form-horizontal">
<la:hidden property="crudMode" />
<c:if test="${crudMode==2}">
<la:hidden property="id" />
<la:hidden property="versionNo" />
</c:if>
<la:hidden property="createdBy" />
<la:hidden property="createdTime" />
<div class="row">
<div class="col-md-12">
<div
class="box <c:if test="${crudMode == 1}">box-success</c:if><c:if test="${crudMode == 2}">box-warning</c:if>">
<div class="box-header with-border">
<jsp:include page="/WEB-INF/view/common/admin/crud/header.jsp"></jsp:include>
</div>
<!-- /.box-header -->
<div class="box-body">
<div>
<la:info id="msg" message="true">
<div class="alert alert-info">${msg}</div>
</la:info>
<la:errors property="_global" />
</div>
<div class="form-group">
<label for="term" class="col-sm-3 control-label"><la:message
key="labels.related_query_term" /></label>
<div class="col-sm-9">
<la:errors property="term" />
<la:text styleId="term" property="term" styleClass="form-control" />
</div>
</div>
<div class="form-group">
<label for="queries" class="col-sm-3 control-label"><la:message
key="labels.related_query_queries" /></label>
<div class="col-sm-9">
<la:errors property="queries" />
<la:textarea styleId="queries" property="queries" styleClass="form-control" rows="5"/>
</div>
</div>
<div class="form-group">
<label for="virtualHost" class="col-sm-3 control-label"><la:message
key="labels.related_query_virtual_host" /></label>
<div class="col-sm-9">
<la:errors property="virtualHost" />
<la:text styleId="virtualHost" property="virtualHost" styleClass="form-control" />
</div>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<jsp:include page="/WEB-INF/view/common/admin/crud/buttons.jsp"></jsp:include>
</div>
<!-- /.box-footer -->
</div>
<!-- /.box -->
</div>
</div>
</la:form>
</section>
</div>
<jsp:include page="/WEB-INF/view/common/admin/footer.jsp"></jsp:include>
</div>
<jsp:include page="/WEB-INF/view/common/admin/foot.jsp"></jsp:include>
</body>
</html>

View file

@ -126,6 +126,20 @@
<span><la:message key="labels.menu_boost_document_rule" /></span>
</la:link></li>
<li
<c:if test="${param.menuType=='relatedContentRule'}">class="active"</c:if>><la:link
href="/admin/relatedcontent/">
<i class='fa fa-circle-o'></i>
<span><la:message key="labels.menu_related_content" /></span>
</la:link></li>
<li
<c:if test="${param.menuType=='relatedQueryRule'}">class="active"</c:if>><la:link
href="/admin/relatedquery/">
<i class='fa fa-circle-o'></i>
<span><la:message key="labels.menu_related_query" /></span>
</la:link></li>
<li
<c:if test="${param.menuType=='pathMapping'}">class="active"</c:if>><la:link
href="/admin/pathmap/">

View file

@ -112,6 +112,32 @@
</div>
</div>
</c:if>
<c:if test="${!empty relatedQueries}">
<div class="row">
<div class="col-md-12">
<p class="popularWordBody ellipsis">
<la:message key="labels.search_related_queries" />
<c:forEach var="item" varStatus="s" items="${relatedQueries}">
<c:if test="${s.index < 3}">
<la:link
href="/search?q=${f:u(item)}${fe:facetQuery()}${fe:geoQuery()}">${f:h(item)}</la:link>
</c:if>
<c:if test="${3 <= s.index}">
<la:link styleClass="hidden-xs"
href="/search?q=${f:u(item)}${fe:facetQuery()}${fe:geoQuery()}">${f:h(item)}</la:link>
</c:if>
</c:forEach>
</p>
</div>
</div>
</c:if>
<c:if test="${!empty relatedContent}">
<div class="row">
<div class="col-md-12">
${relatedContent}
</div>
</div>
</c:if>
<c:choose>
<c:when test="${f:h(allRecordCount) != 0}">
<jsp:include page="searchResults.jsp" />