提交 55978aea 编写于 作者: O o2null

Merge branch 'feature/index' into 'develop'

Feature/index

See merge request o2oa/o2oa!1225
......@@ -37,7 +37,7 @@ public class Person extends ConfigObject {
public static final String REGULAREXPRESSION_SCRIPT = "^\\((.+?)\\)$";
public static final String DEFAULT_PASSWORD = "(var v \\u003d person.getMobile();\\u000a return v.substring(v.length - 6))";
public static final String DEFAULT_PASSWORD = "var v = person.getMobile();\\nreturn v.substring(v.length - 6);";
public static final Integer DEFAULT_PASSWORDPERIOD = 0;
public static final Integer DEFAULT_FAILUREINTERVAL = 10;
public static final Integer DEFAULT_FAILURECOUNT = 5;
......
......@@ -31,7 +31,7 @@ import com.x.base.core.project.tools.DefaultCharset;
*/
public class TernaryManagement extends ConfigObject {
public static final String initPassword = "o2";
public static final String initPassword = "o2oa@2022";
public static final String INIT_SYSTEM_MANAGER = "systemManager";
public static final String INIT_SYSTEM_MANAGER_DISTINGUISHED_NAME = "系统管理员@systemManager@P";
......
......@@ -7,119 +7,119 @@ import com.x.base.core.project.annotation.FieldDescribe;
public class WebServer extends ConfigObject {
private static final long serialVersionUID = 7240874589722986538L;
public static WebServer defaultInstance() {
WebServer o = new WebServer();
o.enable = true;
o.port = DEFAULT_HTTP_PORT;
o.sslEnable = false;
o.proxyHost = "";
o.proxyPort = null;
o.proxyCenterEnable = DEFAULT_PROXYCENTERENABLE;
o.proxyApplicationEnable = DEFAULT_PROXYAPPLICATIONENABLE;
return o;
}
private static final Integer DEFAULT_HTTP_PORT = 80;
private static final Integer DEFAULT_HTTPS_PORT = 443;
private static final Boolean DEFAULT_PROXYCENTERENABLE = true;
private static final Boolean DEFAULT_PROXYAPPLICATIONENABLE = true;
private static final Integer DEFAULT_PROXY_TIMEOUT = 300;
@FieldDescribe("是否启用")
private Boolean enable;
@FieldDescribe("http/https端口,用户输入网址后实际访问的第一个端口.http协议默认为80端口,https默认为443端口.")
private Integer port;
@FieldDescribe("是否启用ssl传输加密,如果启用将使用config/keystore文件作为密钥文件.使用config/token.json文件中的sslKeyStorePassword字段为密钥密码,sslKeyManagerPassword为管理密码.")
private Boolean sslEnable;
@FieldDescribe("代理主机,当服务器是通过apache/nginx等代理服务器映射到公网或者通过路由器做端口映射,在这样的情况下需要设置此地址以标明公网访问地址.")
private String proxyHost;
@FieldDescribe("代理端口,当服务器是通过apache/nginx等代理服务器映射到公网或者通过路由器做端口映射,在这样的情况下需要设置此地址以标明公网访问端口.")
private Integer proxyPort;
@FieldDescribe("是否启用center服务器代理.")
private Boolean proxyCenterEnable;
@FieldDescribe("是否启用application服务器代理")
private Boolean proxyApplicationEnable;
@FieldDescribe("代理连接超时时间,默认300(秒)")
private Integer proxyTimeOut;
public Boolean getProxyCenterEnable() {
return proxyCenterEnable == null ? DEFAULT_PROXYCENTERENABLE : this.proxyCenterEnable;
}
public Boolean getProxyApplicationEnable() {
return proxyApplicationEnable == null ? DEFAULT_PROXYAPPLICATIONENABLE : this.proxyApplicationEnable;
}
public Boolean getEnable() {
return BooleanUtils.isTrue(this.enable);
}
public Integer getPort() {
if ((null != this.port) && (this.port > 0) && (this.port < 65535)) {
return this.port;
} else {
if (BooleanUtils.isTrue(this.getSslEnable())) {
return DEFAULT_HTTPS_PORT;
} else {
return DEFAULT_HTTP_PORT;
}
}
}
public Boolean getSslEnable() {
return BooleanUtils.isTrue(this.sslEnable);
}
public String getProxyHost() {
return StringUtils.isNotEmpty(this.proxyHost) ? this.proxyHost : "";
}
public Integer getProxyPort() {
if (null != this.proxyPort && this.proxyPort > 0 && this.proxyPort < 65535) {
return this.proxyPort;
} else {
return this.getPort();
}
}
public void setEnable(Boolean enable) {
this.enable = enable;
}
public void setPort(Integer port) {
this.port = port;
}
public void setSslEnable(Boolean sslEnable) {
this.sslEnable = sslEnable;
}
public void setProxyHost(String proxyHost) {
this.proxyHost = proxyHost;
}
public void setProxyPort(Integer proxyPort) {
this.proxyPort = proxyPort;
}
public void setProxyApplicationEnable(Boolean proxyApplicationEnable) {
this.proxyApplicationEnable = proxyApplicationEnable;
}
public void setProxyCenterEnable(Boolean proxyCenterEnable) {
this.proxyCenterEnable = proxyCenterEnable;
}
public Integer getProxyTimeOut() {
return proxyTimeOut == null ? DEFAULT_PROXY_TIMEOUT : this.proxyTimeOut;
}
public void setProxyTimeOut(Integer proxyTimeOut) {
this.proxyTimeOut = proxyTimeOut;
}
private static final long serialVersionUID = 7240874589722986538L;
public static WebServer defaultInstance() {
WebServer o = new WebServer();
o.enable = true;
o.port = DEFAULT_HTTP_PORT;
o.sslEnable = false;
o.proxyHost = "";
o.proxyPort = DEFAULT_HTTP_PORT;
o.proxyCenterEnable = DEFAULT_PROXYCENTERENABLE;
o.proxyApplicationEnable = DEFAULT_PROXYAPPLICATIONENABLE;
o.proxyTimeOut = DEFAULT_PROXY_TIMEOUT;
return o;
}
private static final Integer DEFAULT_HTTP_PORT = 80;
private static final Integer DEFAULT_HTTPS_PORT = 443;
private static final Boolean DEFAULT_PROXYCENTERENABLE = true;
private static final Boolean DEFAULT_PROXYAPPLICATIONENABLE = true;
private static final Integer DEFAULT_PROXY_TIMEOUT = 300;
@FieldDescribe("是否启用")
private Boolean enable;
@FieldDescribe("http/https端口,用户输入网址后实际访问的第一个端口.http协议默认为80端口,https默认为443端口.")
private Integer port;
@FieldDescribe("是否启用ssl传输加密,如果启用将使用config/keystore文件作为密钥文件.使用config/token.json文件中的sslKeyStorePassword字段为密钥密码,sslKeyManagerPassword为管理密码.")
private Boolean sslEnable;
@FieldDescribe("代理主机,当服务器是通过apache/nginx等代理服务器映射到公网或者通过路由器做端口映射,在这样的情况下需要设置此地址以标明公网访问地址.")
private String proxyHost;
@FieldDescribe("代理端口,当服务器是通过apache/nginx等代理服务器映射到公网或者通过路由器做端口映射,在这样的情况下需要设置此地址以标明公网访问端口.")
private Integer proxyPort;
@FieldDescribe("是否启用center服务器代理.")
private Boolean proxyCenterEnable;
@FieldDescribe("是否启用application服务器代理")
private Boolean proxyApplicationEnable;
@FieldDescribe("代理连接超时时间,默认300(秒)")
private Integer proxyTimeOut;
public Boolean getProxyCenterEnable() {
return proxyCenterEnable == null ? DEFAULT_PROXYCENTERENABLE : this.proxyCenterEnable;
}
public Boolean getProxyApplicationEnable() {
return proxyApplicationEnable == null ? DEFAULT_PROXYAPPLICATIONENABLE : this.proxyApplicationEnable;
}
public Boolean getEnable() {
return BooleanUtils.isTrue(this.enable);
}
public Integer getPort() {
if ((null != this.port) && (this.port > 0) && (this.port < 65535)) {
return this.port;
} else {
if (BooleanUtils.isTrue(this.getSslEnable())) {
return DEFAULT_HTTPS_PORT;
} else {
return DEFAULT_HTTP_PORT;
}
}
}
public Boolean getSslEnable() {
return BooleanUtils.isTrue(this.sslEnable);
}
public String getProxyHost() {
return StringUtils.isNotEmpty(this.proxyHost) ? this.proxyHost : "";
}
public Integer getProxyPort() {
if (null != this.proxyPort && this.proxyPort > 0 && this.proxyPort < 65535) {
return this.proxyPort;
} else {
return this.getPort();
}
}
public void setEnable(Boolean enable) {
this.enable = enable;
}
public void setPort(Integer port) {
this.port = port;
}
public void setSslEnable(Boolean sslEnable) {
this.sslEnable = sslEnable;
}
public void setProxyHost(String proxyHost) {
this.proxyHost = proxyHost;
}
public void setProxyPort(Integer proxyPort) {
this.proxyPort = proxyPort;
}
public void setProxyApplicationEnable(Boolean proxyApplicationEnable) {
this.proxyApplicationEnable = proxyApplicationEnable;
}
public void setProxyCenterEnable(Boolean proxyCenterEnable) {
this.proxyCenterEnable = proxyCenterEnable;
}
public Integer getProxyTimeOut() {
return proxyTimeOut == null ? DEFAULT_PROXY_TIMEOUT : this.proxyTimeOut;
}
public void setProxyTimeOut(Integer proxyTimeOut) {
this.proxyTimeOut = proxyTimeOut;
}
}
......@@ -26,9 +26,9 @@ import com.x.query.core.express.index.Indexs;
import io.swagger.v3.oas.annotations.media.Schema;
class ActionListCategory extends BaseAction {
class ActionListDirectory extends BaseAction {
private static final Logger LOGGER = LoggerFactory.getLogger(ActionListCategory.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ActionListDirectory.class);
private static final List<String> APPLICATIONATTRIBUTES = Stream
.<String>of(JpaObject.id_FIELDNAME, Application.name_FIELDNAME).collect(Collectors.toUnmodifiableList());
......
package com.x.query.assemble.surface.jaxrs.index;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
......@@ -10,7 +11,10 @@ import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.collections4.list.TreeList;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiReader;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.IndexSearcher;
......@@ -23,7 +27,6 @@ import org.apache.lucene.search.grouping.FirstPassGroupingCollector;
import org.apache.lucene.search.grouping.SearchGroup;
import org.apache.lucene.search.grouping.TermGroupSelector;
import org.apache.lucene.search.grouping.TopGroupsCollector;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
import com.google.gson.JsonElement;
......@@ -62,22 +65,26 @@ class ActionPost extends BaseAction {
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
String category = wi.getCategory();
String key = wi.getKey();
Integer rows = Indexs.rows(wi.getSize());
Integer start = Indexs.start(wi.getPage(), rows);
List<String> readers = new ArrayList<>();
List<String> readers = new TreeList<>();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
String person = business.index().who(effectivePerson, wi.getPerson());
readers = business.index().determineReaders(person, category, key);
wi.getDirectoryList().stream().forEach(o -> {
try {
readers.addAll(business.index().determineReaders(person, o.getCategory(), o.getKey()));
} catch (Exception e) {
LOGGER.error(e);
}
});
}
initWo(wo, wi);
Optional<Query> searchQuery = searchQuery(wi.getQuery(), new HanLPAnalyzer());
Optional<Query> readersQuery = Indexs.readersQuery(readers);
Optional<Query> readersQuery = Indexs.readersQuery(ListTools.trim(readers, true, true));
List<Query> filterQueries = Indexs.filterQueries(wi.getFilterList());
BooleanQuery.Builder builder = new BooleanQuery.Builder();
Stream.of(searchQuery, readersQuery).filter(Optional::isPresent)
......@@ -85,13 +92,13 @@ class ActionPost extends BaseAction {
filterQueries.stream().forEach(o -> builder.add(o, BooleanClause.Occur.MUST));
Query query = builder.build();
LOGGER.debug("index lucene query:{}.", query::toString);
Optional<Directory> optional = Indexs.directory(category, key, true);
if (optional.isEmpty()) {
throw new ExceptionDirectoryNotExist();
IndexReader[] indexReaders = this.indexReaders(wi);
if (indexReaders.length == 0) {
return result;
}
try (DirectoryReader reader = DirectoryReader.open(optional.get())) {
wo.setDynamicFieldList(getDynamicFieldList(reader));
IndexSearcher searcher = new IndexSearcher(reader);
try (MultiReader multiReader = new MultiReader(indexReaders)) {
IndexSearcher searcher = new IndexSearcher(multiReader);
wo.setDynamicFieldList(getDynamicFieldList(multiReader));
TopFieldCollector topFieldCollector = TopFieldCollector.create(sort(wi.getSort()), 1000, 1000);
List<Pair<String, FirstPassGroupingCollector<BytesRef>>> firstPassGroupingCollectorPairs = Indexs
.adjustFacetField(wi.getFilterList().stream().map(Filter::getField).collect(Collectors.toList()))
......@@ -146,10 +153,22 @@ class ActionPost extends BaseAction {
return result;
}
private void initWo(Wo wo, Wi wi) {
private void initWo(Wo wo) {
wo.setFixedFieldList(this.getFixedFieldList(Indexs.CATEGORY_PROCESSPLATFORM));
}
private IndexReader[] indexReaders(Wi wi) {
return wi.getDirectoryList().stream().map(o -> Indexs.directory(o.getCategory(), o.getKey(), true))
.filter(Optional::isPresent).map(Optional::get).map(o -> {
try {
return DirectoryReader.open(o);
} catch (IOException e) {
LOGGER.error(e);
}
return null;
}).filter(o -> !Objects.isNull(o)).toArray(s -> new IndexReader[s]);
}
private void writeDocument(IndexSearcher searcher, TopFieldCollector topFieldCollector, int start, int rows, Wo wo,
List<String> fixedFieldList, List<String> dynamicFieldList) {
List<String> outFields = outFields(wo, fixedFieldList, dynamicFieldList);
......
package com.x.query.assemble.surface.jaxrs.index;
//package com.x.query.assemble.surface.jaxrs.index;
//
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Collection;
//import java.util.List;
//import java.util.Map;
//import java.util.Objects;
//import java.util.Optional;
//import java.util.stream.Collectors;
//import java.util.stream.Stream;
//
//import org.apache.lucene.index.DirectoryReader;
//import org.apache.lucene.search.BooleanClause;
//import org.apache.lucene.search.BooleanQuery;
//import org.apache.lucene.search.IndexSearcher;
//import org.apache.lucene.search.MultiCollector;
//import org.apache.lucene.search.Query;
//import org.apache.lucene.search.ScoreDoc;
//import org.apache.lucene.search.TopDocs;
//import org.apache.lucene.search.TopFieldCollector;
//import org.apache.lucene.search.grouping.FirstPassGroupingCollector;
//import org.apache.lucene.search.grouping.SearchGroup;
//import org.apache.lucene.search.grouping.TermGroupSelector;
//import org.apache.lucene.search.grouping.TopGroupsCollector;
//import org.apache.lucene.store.Directory;
//import org.apache.lucene.util.BytesRef;
//
//import com.google.gson.JsonElement;
//import com.hankcs.lucene.HanLPAnalyzer;
//import com.x.base.core.container.EntityManagerContainer;
//import com.x.base.core.container.factory.EntityManagerContainerFactory;
//import com.x.base.core.project.bean.tuple.Pair;
//import com.x.base.core.project.bean.tuple.Quadruple;
//import com.x.base.core.project.config.Config;
//import com.x.base.core.project.http.ActionResult;
//import com.x.base.core.project.http.EffectivePerson;
//import com.x.base.core.project.logger.Logger;
//import com.x.base.core.project.logger.LoggerFactory;
//import com.x.base.core.project.tools.ListTools;
//import com.x.query.assemble.surface.Business;
//import com.x.query.core.express.assemble.surface.jaxrs.index.ActionPostWi;
//import com.x.query.core.express.assemble.surface.jaxrs.index.ActionPostWo;
//import com.x.query.core.express.index.Facets;
//import com.x.query.core.express.index.Filter;
//import com.x.query.core.express.index.Indexs;
//import com.x.query.core.express.index.WoField;
//
//import io.swagger.v3.oas.annotations.media.Schema;
//
//class ActionPost extends BaseAction {
//
// private static final Logger LOGGER = LoggerFactory.getLogger(ActionPost.class);
//
// ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
//
// LOGGER.info("execute:{}.", effectivePerson::getDistinguishedName);
//
// ActionResult<Wo> result = new ActionResult<>();
// Wo wo = new Wo();
// result.setData(wo);
//
// Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
//
// String category = wi.getCategory();
// String key = wi.getKey();
// Integer rows = Indexs.rows(wi.getSize());
// Integer start = Indexs.start(wi.getPage(), rows);
//
// List<String> readers = new ArrayList<>();
// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
// Business business = new Business(emc);
// String person = business.index().who(effectivePerson, wi.getPerson());
// readers = business.index().determineReaders(person, category, key);
// }
//
// initWo(wo, wi);
//
// Optional<Query> searchQuery = searchQuery(wi.getQuery(), new HanLPAnalyzer());
// Optional<Query> readersQuery = Indexs.readersQuery(readers);
// List<Query> filterQueries = Indexs.filterQueries(wi.getFilterList());
// BooleanQuery.Builder builder = new BooleanQuery.Builder();
// Stream.of(searchQuery, readersQuery).filter(Optional::isPresent)
// .forEach(o -> builder.add(o.get(), BooleanClause.Occur.MUST));
// filterQueries.stream().forEach(o -> builder.add(o, BooleanClause.Occur.MUST));
// Query query = builder.build();
// LOGGER.debug("index lucene query:{}.", query::toString);
// Optional<Directory> optional = Indexs.directory(category, key, true);
// if (optional.isEmpty()) {
// throw new ExceptionDirectoryNotExist();
// }
// try (DirectoryReader reader = DirectoryReader.open(optional.get())) {
// wo.setDynamicFieldList(getDynamicFieldList(reader));
// IndexSearcher searcher = new IndexSearcher(reader);
// TopFieldCollector topFieldCollector = TopFieldCollector.create(sort(wi.getSort()), 1000, 1000);
// List<Pair<String, FirstPassGroupingCollector<BytesRef>>> firstPassGroupingCollectorPairs = Indexs
// .adjustFacetField(wi.getFilterList().stream().map(Filter::getField).collect(Collectors.toList()))
// .stream()
// .<Pair<String, FirstPassGroupingCollector<BytesRef>>>map(o -> {
// try {
// return Pair.of(o,
// new FirstPassGroupingCollector<>(new TermGroupSelector(o),
// org.apache.lucene.search.Sort.INDEXORDER,
// Config.query().index().getFacetMaxGroups()));
// } catch (Exception ex) {
// LOGGER.error(ex);
// }
// return null;
// }).filter(o -> !Objects.isNull(o)).collect(Collectors.toList());
// searcher.search(query, MultiCollector.wrap(topFieldCollector, MultiCollector
// .wrap(firstPassGroupingCollectorPairs.stream().map(Pair::second).collect(Collectors.toList()))));
// writeDocument(searcher, topFieldCollector, start, rows, wo, wi.getFixedFieldList(),
// wi.getDynamicFieldList());
// List<Pair<String, TopGroupsCollector<BytesRef>>> topGroupsCollectorPairs = firstPassGroupingCollectorPairs
// .stream().<Pair<String, Optional<Collection<SearchGroup<BytesRef>>>>>map(param -> {
// Collection<SearchGroup<BytesRef>> topGroups = null;
// try {
// topGroups = param.second().getTopGroups(0);
// } catch (Exception e) {
// LOGGER.error(e);
// }
// if (Objects.isNull(topGroups)) {
// return Pair.of(param.first(), Optional.empty());
// } else {
// return Pair.of(param.first(), Optional.of(topGroups));
// }
// }).filter(o -> o.second().isPresent())
// .<Pair<String, TopGroupsCollector<BytesRef>>>map(param -> {
// try {
// return Pair.of(param.first(),
// new TopGroupsCollector<>(new TermGroupSelector(param.first()), param.second().get(),
// org.apache.lucene.search.Sort.INDEXORDER,
// org.apache.lucene.search.Sort.INDEXORDER,
// Config.query().index().getSearchMaxHits(), false));
// } catch (Exception e) {
// LOGGER.error(e);
// }
// return null;
// }).filter(o -> !Objects.isNull(o)).collect(Collectors.toList());
// if (!topGroupsCollectorPairs.isEmpty()) {
// searcher.search(query, MultiCollector
// .wrap(topGroupsCollectorPairs.stream().map(Pair::second).collect(Collectors.toList())));
// wo.setFacetList(Facets.topGroupsCollector(topGroupsCollectorPairs));
// }
// }
// return result;
// }
//
// private void initWo(Wo wo, Wi wi) {
// wo.setFixedFieldList(this.getFixedFieldList(Indexs.CATEGORY_PROCESSPLATFORM));
// }
//
// private void writeDocument(IndexSearcher searcher, TopFieldCollector topFieldCollector, int start, int rows, Wo wo,
// List<String> fixedFieldList, List<String> dynamicFieldList) {
// List<String> outFields = outFields(wo, fixedFieldList, dynamicFieldList);
// TopDocs topDocs = topFieldCollector.topDocs(start, rows);
// wo.setCount(topDocs.totalHits.value);
// ScoreDoc[] scoreDocs = topDocs.scoreDocs;
// if (null != scoreDocs) {
// Arrays.stream(scoreDocs).forEach(o -> {
// try {
// org.apache.lucene.document.Document document = searcher.doc(o.doc);
// Map<String, Object> map = outFields.stream()
// .map(f -> Quadruple.of(Indexs.judgeField(f), document.getField(f)))
// .filter(param -> null != param.fourth())
// .map(p -> Pair.of(p.first(), Indexs.indexableFieldValue(p.fourth(), p.third())))
// .collect(Collectors.toMap(Pair::first, Pair::second));
// wo.getDocumentList().add(map);
// } catch (Exception e) {
// LOGGER.error(e);
// }
// });
// }
// }
//
// private List<String> outFields(Wo wo, List<String> fixedFieldList, List<String> dynamicFieldList) {
// List<String> list = new ArrayList<>();
// list.add(Indexs.FIELD_ID);
// if (ListTools.isEmpty(fixedFieldList) && ListTools.isEmpty(dynamicFieldList)) {
// list.addAll(wo.getFixedFieldList().stream().map(WoField::getField).collect(Collectors.toList()));
// } else {
// list.addAll(fixedFieldList);
// list.addAll(dynamicFieldList);
// }
// return list;
// }
//
// @Schema(name = "com.x.custom.index.assemble.control.jaxrs.index.ActionPost$Wo")
// public class Wo extends ActionPostWo {
//
// private static final long serialVersionUID = 3751674531291729956L;
//
// }
//
// @Schema(name = "com.x.custom.index.assemble.control.jaxrs.index.ActionPost$Wi")
// public class Wi extends ActionPostWi {
//
// private static final long serialVersionUID = -4646809016933808952L;
//
// }
//
//}
\ No newline at end of file
......@@ -12,8 +12,7 @@ import java.util.stream.Collectors;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.PointValues;
import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.queryparser.classic.QueryParser;
......@@ -37,9 +36,7 @@ import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.DateTools;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.CategoryInfo;
import com.x.processplatform.core.entity.element.Application;
import com.x.processplatform.core.entity.element.Process;
import com.x.query.core.express.index.Indexs;
import com.x.query.core.express.index.Sort;
import com.x.query.core.express.index.WoFacet;
......@@ -60,13 +57,13 @@ abstract class BaseAction extends StandardJaxrsAction {
new WoField(Indexs.FIELD_UPDATETIME, "更新时间", Indexs.FIELD_TYPE_DATE),
new WoField(Indexs.FIELD_SERIAL, "文号", Indexs.FIELD_TYPE_STRING),
new WoField(Indexs.FIELD_PROCESSNAME, "流程", Indexs.FIELD_TYPE_STRING)));
protected static final List<WoField> FIXEDFIELD_PROCESS = ListUtils
.unmodifiableList(Arrays.asList(new WoField(Indexs.FIELD_TITLE, "标题", Indexs.FIELD_TYPE_STRING),
new WoField(Indexs.FIELD_CREATORPERSON, "创建者", Indexs.FIELD_TYPE_STRING),
new WoField(Indexs.FIELD_CREATORUNIT, "部门", Indexs.FIELD_TYPE_STRING),
new WoField(Indexs.FIELD_CREATETIME, "创建时间", Indexs.FIELD_TYPE_DATE),
new WoField(Indexs.FIELD_UPDATETIME, "更新时间", Indexs.FIELD_TYPE_DATE),
new WoField(Indexs.FIELD_SERIAL, "文号", Indexs.FIELD_TYPE_STRING)));
// protected static final List<WoField> FIXEDFIELD_PROCESS = ListUtils
// .unmodifiableList(Arrays.asList(new WoField(Indexs.FIELD_TITLE, "标题", Indexs.FIELD_TYPE_STRING),
// new WoField(Indexs.FIELD_CREATORPERSON, "创建者", Indexs.FIELD_TYPE_STRING),
// new WoField(Indexs.FIELD_CREATORUNIT, "部门", Indexs.FIELD_TYPE_STRING),
// new WoField(Indexs.FIELD_CREATETIME, "创建时间", Indexs.FIELD_TYPE_DATE),
// new WoField(Indexs.FIELD_UPDATETIME, "更新时间", Indexs.FIELD_TYPE_DATE),
// new WoField(Indexs.FIELD_SERIAL, "文号", Indexs.FIELD_TYPE_STRING)));
protected static final List<WoField> FIXEDFIELD_APPINFO = ListUtils
.unmodifiableList(Arrays.asList(new WoField(Indexs.FIELD_TITLE, "标题", Indexs.FIELD_TYPE_STRING),
new WoField(Indexs.FIELD_CREATORPERSON, "创建者", Indexs.FIELD_TYPE_STRING),
......@@ -75,13 +72,13 @@ abstract class BaseAction extends StandardJaxrsAction {
new WoField(Indexs.FIELD_UPDATETIME, "更新时间", Indexs.FIELD_TYPE_DATE),
new WoField(Indexs.FIELD_CATEGORYNAME, "分类", Indexs.FIELD_TYPE_STRING),
new WoField(Indexs.FIELD_DESCRIPTION, "说明", Indexs.FIELD_TYPE_STRING)));
protected static final List<WoField> FIXEDFIELD_CATEGORYINFO = ListUtils
.unmodifiableList(Arrays.asList(new WoField(Indexs.FIELD_TITLE, "标题", Indexs.FIELD_TYPE_STRING),
new WoField(Indexs.FIELD_CREATORPERSON, "创建者", Indexs.FIELD_TYPE_STRING),
new WoField(Indexs.FIELD_CREATORUNIT, "部门", Indexs.FIELD_TYPE_STRING),
new WoField(Indexs.FIELD_CREATETIME, "创建时间", Indexs.FIELD_TYPE_DATE),
new WoField(Indexs.FIELD_UPDATETIME, "更新时间", Indexs.FIELD_TYPE_DATE),
new WoField(Indexs.FIELD_DESCRIPTION, "说明", Indexs.FIELD_TYPE_STRING)));
// protected static final List<WoField> FIXEDFIELD_CATEGORYINFO = ListUtils
// .unmodifiableList(Arrays.asList(new WoField(Indexs.FIELD_TITLE, "标题", Indexs.FIELD_TYPE_STRING),
// new WoField(Indexs.FIELD_CREATORPERSON, "创建者", Indexs.FIELD_TYPE_STRING),
// new WoField(Indexs.FIELD_CREATORUNIT, "部门", Indexs.FIELD_TYPE_STRING),
// new WoField(Indexs.FIELD_CREATETIME, "创建时间", Indexs.FIELD_TYPE_DATE),
// new WoField(Indexs.FIELD_UPDATETIME, "更新时间", Indexs.FIELD_TYPE_DATE),
// new WoField(Indexs.FIELD_DESCRIPTION, "说明", Indexs.FIELD_TYPE_STRING)));
protected static final List<String> FACET_FIELDS = ListUtils
.unmodifiableList(Arrays.asList(Indexs.FIELD_CREATETIMEMONTH, Indexs.FIELD_UPDATETIMEMONTH,
......@@ -157,7 +154,7 @@ abstract class BaseAction extends StandardJaxrsAction {
}
}
protected List<WoField> getDynamicFieldList(DirectoryReader reader) {
protected List<WoField> getDynamicFieldList(IndexReader reader) {
List<WoField> list = org.apache.lucene.luke.models.util.IndexUtils.getFieldNames(reader).stream()
.filter(o -> StringUtils.startsWithAny(o, Indexs.PREFIX_FIELD_DATA_STRING,
Indexs.PREFIX_FIELD_DATA_STRINGS, Indexs.PREFIX_FIELD_DATA_BOOLEAN,
......
......@@ -102,18 +102,18 @@ public class IndexAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@Operation(summary = "获取检索目录列表.", operationId = OPERATIONID_PREFIX + "listCategory", responses = {
@ApiResponse(content = { @Content(schema = @Schema(implementation = ActionListCategory.Wo.class)) }) })
@JaxrsMethodDescribe(value = "获取检索目录列表.", action = ActionListCategory.class)
@Operation(summary = "获取检索目录列表.", operationId = OPERATIONID_PREFIX + "listDirectory", responses = {
@ApiResponse(content = { @Content(schema = @Schema(implementation = ActionListDirectory.Wo.class)) }) })
@JaxrsMethodDescribe(value = "获取检索目录列表.", action = ActionListDirectory.class)
@GET
@Path("list/category")
@Path("list/directory")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listCategory(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<List<ActionListCategory.Wo>> result = new ActionResult<>();
public void listDirectory(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<List<ActionListDirectory.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListCategory().execute(effectivePerson);
result = new ActionListDirectory().execute(effectivePerson);
} catch (Exception e) {
LOGGER.error(e, effectivePerson, request, null);
result.error(e);
......
......@@ -14,13 +14,9 @@ public class ActionPostWi extends GsonPropertyObject {
private static final long serialVersionUID = 1360655000630283661L;
@FieldDescribe("分类.")
@Schema(description = "分类.")
private String category;
@FieldDescribe("标识.")
@Schema(description = "标识.")
private String key;
@FieldDescribe("检索目录.")
@Schema(description = "检索目录.")
private List<WiDirectory> directoryList = new ArrayList<>();
@FieldDescribe("搜索内容.")
@Schema(description = "搜索内容.")
......@@ -102,20 +98,12 @@ public class ActionPostWi extends GsonPropertyObject {
this.size = size;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
public List<WiDirectory> getDirectoryList() {
return directoryList;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
public void setDirectoryList(List<WiDirectory> directoryList) {
this.directoryList = directoryList;
}
public String getPerson() {
......@@ -134,4 +122,33 @@ public class ActionPostWi extends GsonPropertyObject {
this.filterList = filterList;
}
@Schema(name = "com.x.query.core.express.assemble.surface.jaxrs.index.ActionPostWi$WiDirectory")
public static class WiDirectory {
@FieldDescribe("分类.")
@Schema(description = "分类.")
private String category;
@FieldDescribe("标识.")
@Schema(description = "标识.")
private String key;
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册