Commit ac310f68 by xmh

动态匹配

1 parent e0a8d848
......@@ -37,7 +37,7 @@
<dependency>
<groupId>com.viontech.keliu</groupId>
<artifactId>keliu-base</artifactId>
<version>6.0.9</version>
<version>6.0.9-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>pagehelper-spring-boot-starter</artifactId>
......@@ -62,7 +62,7 @@
<dependency>
<groupId>com.viontech.keliu</groupId>
<artifactId>AlgApiClient</artifactId>
<version>6.0.5</version>
<version>6.0.6-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>javax</groupId>
......
package com.viontech.match.config;
import java.text.SimpleDateFormat;
/**
* 常量
*
......@@ -25,4 +27,6 @@ public class Constant {
public final static int FACE_MATCH_RESULT_SIZE = 5;
/** 人体匹配结果的数量 */
public final static int BODY_MATCH_RESULT_SIZE = 10;
public final static ThreadLocal<SimpleDateFormat> DATE_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
}
......@@ -22,6 +22,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.rest.RestStatus;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -47,6 +48,10 @@ public class PoolService {
private RestHighLevelClient client;
@Resource
private ObjectMapper objectMapper;
@Value("${vion.index.number_of_shards:1}")
private Integer shards;
@Value("${vion.index.number_of_replicas:0}")
private Integer replicas;
/**
* 添加特征池
......@@ -65,8 +70,8 @@ public class PoolService {
XContentBuilder builder = getCreateIndexContentBuilder();
createIndexRequest.mapping(builder);
Settings.Builder setting = Settings.builder();
setting.put("index.number_of_shards", 1);
setting.put("index.number_of_replicas", 0);
setting.put("index.number_of_shards", shards);
setting.put("index.number_of_replicas", replicas);
createIndexRequest.settings(setting);
CreateIndexResponse createIndexResponse = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
......@@ -147,6 +152,7 @@ public class PoolService {
BulkResponse bulkItemResponses = personService.addPerson(poolId, personPool);
if (bulkItemResponses != null && bulkItemResponses.hasFailures()) {
log.info(bulkItemResponses.buildFailureMessage());
return ResponseVo.error(rid, bulkItemResponses.buildFailureMessage());
}
log.info("特征池修改操作完成:[{}],updateType:[{}]", poolId, updateType);
......@@ -159,7 +165,9 @@ public class PoolService {
/**
* 查询特征池信息
*
* @param requestVo rid,listAll,poolId
*
* @return ResponseVo
* @throws Exception --
*/
......@@ -210,6 +218,7 @@ public class PoolService {
builder.field("dims", Constant.FACE_FEATURE_DIMS);
}
builder.endObject();
// 人体特征
builder.startObject("body");
{
......@@ -217,12 +226,14 @@ public class PoolService {
builder.field("dims", Constant.BODY_FEATURE_DIMS_2048);
}
builder.endObject();
// 人员id
builder.startObject("personId");
{
builder.field("type", "keyword");
}
builder.endObject();
// 特征id
builder.startObject("fid");
{
......@@ -230,6 +241,7 @@ public class PoolService {
}
builder.endObject();
// 年龄
builder.startObject("age");
{
builder.field("type", "integer");
......@@ -238,6 +250,7 @@ public class PoolService {
}
builder.endObject();
// 性别
builder.startObject("gender");
{
builder.field("type", "keyword");
......@@ -245,6 +258,32 @@ public class PoolService {
builder.field("index", false);
}
builder.endObject();
// 时间
builder.startObject("counttime");
{
builder.field("type", "date");
builder.field("format", "yyyy-MM-dd HH:mm:ss");
}
builder.endObject();
// 通道序列号
builder.startObject("channelSerialNum");
{
builder.field("type", "keyword");
}
builder.endObject();
// 身体特征类型类型
builder.startObject("body_type");
{
builder.field("type", "integer");
builder.field("doc_values", false);
builder.field("index", false);
}
builder.endObject();
}
builder.endObject();
}
......
......@@ -4,3 +4,7 @@ spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
# es
spring.elasticsearch.rest.uris=http://127.0.0.1:9200
#\u5206\u7247\u6570\u91CF
vion.index.number_of_shards=1
#\u526F\u672C\u6570\u91CF
vion.index.number_of_replicas=0
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!