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 1c4ec01c
authored
Sep 12, 2024
by
姚冰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[chg] 去除强制刷新,搜索修改
1 parent
9998e1cb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
src/main/java/com/viontech/match/service/PersonService.java
src/main/java/com/viontech/match/service/PersonService.java
View file @
1c4ec01
...
...
@@ -115,8 +115,8 @@ public class PersonService {
BoolQuery
boolQuery
=
getSearchSourceCountBuilder
(
feature
,
person
,
1
);
query
=
boolQuery
.
_toQuery
();
}
else
{
ScriptScore
Query
scriptScoreQuery
=
getScriptScoreQuery
(
feature
,
person
,
1
);
query
=
scriptScoreQuery
.
_toQuery
()
;
Query
scriptScoreQuery
=
getScriptScoreQuery
(
feature
,
person
,
1
);
query
=
scriptScoreQuery
;
}
SearchRequest
request
=
new
SearchRequest
.
Builder
().
index
(
Arrays
.
asList
(
indices
)).
ignoreUnavailable
(
true
).
aggregations
(
"countId"
,
countAggregation
).
size
(
0
).
query
(
query
).
build
();
...
...
@@ -312,7 +312,7 @@ public class PersonService {
return
null
;
}
BulkResponse
bulk
=
client
.
bulk
(
new
BulkRequest
.
Builder
().
index
(
poolId
).
operations
(
operationList
).
build
());
poolService
.
refreshPool
(
poolId
);
//
poolService.refreshPool(poolId);
return
bulk
;
}
...
...
@@ -413,16 +413,17 @@ public class PersonService {
return
list
.
stream
().
map
(
x
->
x
.
floatValue
()).
collect
(
Collectors
.
toList
());
}
private
ScriptScoreQuery
getScriptScoreQuery
(
Double
[]
feature
,
Person
person
,
int
type
)
{
return
new
ScriptScoreQuery
.
Builder
()
.
query
(
getSearchSourceBuilder
(
feature
,
person
,
type
).
_toQuery
())
.
script
(
new
Script
.
Builder
()
.
lang
(
"painless"
)
.
source
(
"_score * 100"
)
.
params
(
"body"
,
JsonData
.
of
(
0.0f
))
.
build
())
.
boost
(
1.0f
)
.
build
();
private
Query
getScriptScoreQuery
(
Double
[]
feature
,
Person
person
,
int
type
)
{
return
new
Query
.
Builder
().
knn
(
getSearchSourceBuilder
(
feature
,
person
,
type
)).
build
();
// return new ScriptScoreQuery.Builder()
// .query(getSearchSourceBuilder(feature, person, type)._toQuery())
// .script(new Script.Builder()
// .lang("painless")
// .source("_score * 100")
// .params("body", JsonData.of(0.0f))
// .build())
// .boost(1.0f)
// .build();
}
private
BoolQuery
getSearchSourceCountBuilder
(
Double
[]
feature
,
Person
person
,
int
type
)
{
...
...
@@ -510,7 +511,7 @@ public class PersonService {
private
SearchRequest
getSearchRequest
(
String
rid
,
String
poolId
,
Integer
matchResultSize
,
Double
[]
feature
,
Person
person
,
int
type
,
Boolean
agg
)
{
// BoolQuery.Builder builder = getSearchSourceBuilder(feature, person, type);
ScriptScore
Query
scriptScoreQuery
=
getScriptScoreQuery
(
feature
,
person
,
1
);
Query
scriptScoreQuery
=
getScriptScoreQuery
(
feature
,
person
,
1
);
if
(
agg
)
{
// AggregationBuilders.max("max_score", s -> s.field("_score").script(new Script.Builder().source("_score").build()));
// Aggregation aggregation = AggregationBuilders.max(s -> s.field("max_score").script(new Script.Builder().source("_score").build()));
...
...
@@ -536,7 +537,7 @@ public class PersonService {
// log.debug("rid:{} poolId:{} 匹配时参数:{}", rid, poolId, scriptScoreQuery.toString());
// KnnSearch knnQuery = getKnnSearch(feature, person, type);
// ScriptScoreQuery scriptScoreQuery = getScriptScoreQuery(feature, person, type);
return
new
SearchRequest
.
Builder
().
index
(
poolId
).
query
(
scriptScoreQuery
.
_toQuery
()).
source
(
sourceConfig
).
size
(
matchResultSize
).
minScore
(
person
.
getBodyMinScore
().
doubleValue
()
).
build
();
return
new
SearchRequest
.
Builder
().
index
(
poolId
).
query
(
scriptScoreQuery
).
source
(
sourceConfig
).
size
(
matchResultSize
).
minScore
(
person
.
getBodyMinScore
().
doubleValue
()/
100
).
build
();
}
private
List
<
Person
>
match0
(
SearchRequest
searchRequest
,
Boolean
agg
)
throws
Exception
{
...
...
@@ -580,7 +581,7 @@ public class PersonService {
})
.
orElse
(
null
));
p
.
setScore
(
item
.
score
().
floatValue
());
p
.
setScore
(
item
.
score
().
floatValue
()
*
100
);
p
.
setPersonPoolId
(
item
.
index
());
persons
.
add
(
p
);
}
...
...
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