Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
VVAS-Match
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3a0dd477
authored
Nov 07, 2024
by
姚冰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[chg] 聚合解析修正,结果字段修正
1 parent
d16d3a99
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
src/main/java/com/viontech/match/entity/SearchResultHit.java
src/main/java/com/viontech/match/service/PersonService.java
src/main/java/com/viontech/match/entity/SearchResultHit.java
View file @
3a0dd47
...
...
@@ -16,7 +16,8 @@ public class SearchResultHit {
private
String
_score
;
private
Integer
age
;
private
String
gender
;
private
Integer
bodyType
;
private
Integer
body_type
;
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
private
String
counttime
;
private
String
fid
;
...
...
src/main/java/com/viontech/match/service/PersonService.java
View file @
3a0dd47
...
...
@@ -170,8 +170,8 @@ public class PersonService {
pool
.
setPersonPoolId
(
id
);
if
(
poolService
.
existPool
(
id
))
{
pool
.
setStatus
(
0
);
//
List<Person> face = matchPerson(rid, id, requestVo.getPerson(), 0, size, agg);
//
matchFaces.addAll(face);
List
<
Person
>
face
=
matchPerson
(
rid
,
id
,
requestVo
.
getPerson
(),
0
,
size
,
agg
);
matchFaces
.
addAll
(
face
);
List
<
Person
>
body
=
matchPerson
(
rid
,
id
,
requestVo
.
getPerson
(),
1
,
size
,
agg
);
matchBodies
.
addAll
(
body
);
}
else
{
...
...
@@ -566,9 +566,14 @@ public class PersonService {
// log.info("request:{}", JSON.tojsonS);
SearchResponse
<
SearchResultHit
>
search
=
client
.
search
(
searchRequest
,
SearchResultHit
.
class
);
if
(
agg
)
{
Map
aggregations
=
search
.
aggregations
();
TermsAggregation
byPersonId
=
(
TermsAggregation
)
aggregations
.
get
(
"by_personId"
);
log
.
info
(
"aggregation:{}"
,
byPersonId
.
toString
());
StringTermsAggregate
byPersonId
=
(
StringTermsAggregate
)
search
.
aggregations
().
get
(
"by_personId"
).
_get
();
for
(
StringTermsBucket
bucket
:
byPersonId
.
buckets
().
array
())
{
String
personId
=
bucket
.
key
().
stringValue
();
MaxAggregate
maxAggregate
=
(
MaxAggregate
)
bucket
.
aggregations
().
get
(
"max_score"
).
_get
();
double
value
=
maxAggregate
.
value
();
Person
person
=
new
Person
().
setPersonId
(
personId
).
setScore
((
float
)
value
).
setPersonPoolId
(
poolId
);
persons
.
add
(
person
);
}
// List<Bucket> buckets = byPersonId.;
// for (Terms.Bucket bucket : buckets) {
// String personId = (String) bucket.getKey();
...
...
@@ -588,7 +593,7 @@ public class PersonService {
p
.
setAge
(
hit
.
getAge
());
p
.
setGender
((
String
)
hit
.
getGender
());
p
.
setChannelSerialNum
(
hit
.
getChannelSerialNum
());
p
.
setBodyType
(
hit
.
getBody
T
ype
());
p
.
setBodyType
(
hit
.
getBody
_t
ype
());
p
.
setCaptureUnid
(
hit
.
getUnid
());
p
.
setPersonType
(
hit
.
getPersonType
());
p
.
setCounttime
(
Optional
.
ofNullable
((
String
)
hit
.
getCounttime
())
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment