Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenjunjie
brandkbs2
Commits
d61e307f
Commit
d61e307f
authored
Mar 23, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
渠道预警-竞品筛选调整
parent
a08d18d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
src/main/java/com/zhiwei/brandkbs2/es/EsQueryTools.java
+8
-5
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectWarnServiceImpl.java
+5
-5
No files found.
src/main/java/com/zhiwei/brandkbs2/es/EsQueryTools.java
View file @
d61e307f
...
@@ -206,12 +206,15 @@ public class EsQueryTools {
...
@@ -206,12 +206,15 @@ public class EsQueryTools {
}
}
public
static
void
assembleContendsQuery
(
BoolQueryBuilder
query
,
Collection
<
String
>
contends
)
{
public
static
void
assembleContendsQuery
(
BoolQueryBuilder
query
,
Collection
<
String
>
contends
)
{
if
(
CollectionUtils
.
isEmpty
(
contends
))
{
BoolQueryBuilder
contendQuery
=
QueryBuilders
.
boolQuery
();
return
;
// 本品舆情一定有
}
contendQuery
.
should
(
cacheMapsNestedQuery
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.contend_id.keyword"
,
Constant
.
PRIMARY_CONTEND_ID
)));
for
(
String
contendId
:
contends
)
{
if
(!
CollectionUtils
.
isEmpty
(
contends
))
{
query
.
should
(
cacheMapsNestedQuery
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.contend_id.keyword"
,
contendId
)));
for
(
String
contendId
:
contends
)
{
contendQuery
.
should
(
cacheMapsNestedQuery
(
QueryBuilders
.
termQuery
(
"brandkbs_cache_maps.contend_id.keyword"
,
contendId
)));
}
}
}
query
.
must
(
contendQuery
);
}
}
public
static
void
assembleContendsQuery4Channel
(
BoolQueryBuilder
query
,
Collection
<
String
>
contends
)
{
public
static
void
assembleContendsQuery4Channel
(
BoolQueryBuilder
query
,
Collection
<
String
>
contends
)
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ProjectWarnServiceImpl.java
View file @
d61e307f
...
@@ -12,14 +12,16 @@ import com.zhiwei.brandkbs2.enmus.EmotionEnum;
...
@@ -12,14 +12,16 @@ import com.zhiwei.brandkbs2.enmus.EmotionEnum;
import
com.zhiwei.brandkbs2.es.EsClientDao
;
import
com.zhiwei.brandkbs2.es.EsClientDao
;
import
com.zhiwei.brandkbs2.es.EsQueryTools
;
import
com.zhiwei.brandkbs2.es.EsQueryTools
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.*
;
import
com.zhiwei.brandkbs2.pojo.AbstractProject
;
import
com.zhiwei.brandkbs2.pojo.BaseMap
;
import
com.zhiwei.brandkbs2.pojo.Channel
;
import
com.zhiwei.brandkbs2.pojo.Project
;
import
com.zhiwei.brandkbs2.pojo.external.*
;
import
com.zhiwei.brandkbs2.pojo.external.*
;
import
com.zhiwei.brandkbs2.pojo.vo.CrisisCaseWarnVO
;
import
com.zhiwei.brandkbs2.pojo.vo.CrisisCaseWarnVO
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectService
;
import
com.zhiwei.brandkbs2.service.ProjectWarnService
;
import
com.zhiwei.brandkbs2.service.ProjectWarnService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.event.core.EventClient
;
import
com.zhiwei.middleware.event.pojo.entity.Event
;
import
com.zhiwei.middleware.event.pojo.entity.Event
;
import
com.zhiwei.middleware.event.pojo.entity.EventTagBasicInfo
;
import
com.zhiwei.middleware.event.pojo.entity.EventTagBasicInfo
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -603,10 +605,8 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
...
@@ -603,10 +605,8 @@ public class ProjectWarnServiceImpl implements ProjectWarnService {
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getMarkerTags
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getMarkerTags
()))
{
config
.
getMarkerTags
().
forEach
(
tagName
->
sourceBuilder
.
should
(
QueryBuilders
.
termQuery
(
"brandkbs_mark_cache_maps.name.keyword"
,
tagName
)));
config
.
getMarkerTags
().
forEach
(
tagName
->
sourceBuilder
.
should
(
QueryBuilders
.
termQuery
(
"brandkbs_mark_cache_maps.name.keyword"
,
tagName
)));
}
}
if
(
CollectionUtils
.
isNotEmpty
(
config
.
getContends
()))
{
EsQueryTools
.
assembleContendsQuery
(
sourceBuilder
,
config
.
getContends
());
}
postFilter
.
must
(
sourceBuilder
);
postFilter
.
must
(
sourceBuilder
);
EsQueryTools
.
assembleContendsQuery
(
postFilter
,
config
.
getContends
());
// postFilter.must(EsQueryTools.assembleNormalKeywordQuery(config.getKeyword(), new String[]{GenericAttribute.ES_IND_FULL_TEXT}));
// postFilter.must(EsQueryTools.assembleNormalKeywordQuery(config.getKeyword(), new String[]{GenericAttribute.ES_IND_FULL_TEXT}));
helper
.
setPostFilter
(
postFilter
);
helper
.
setPostFilter
(
postFilter
);
SearchHits
searchHits
=
esClientDao
.
searchHits
(
helper
);
SearchHits
searchHits
=
esClientDao
.
searchHits
(
helper
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment