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
a227ea9f
Commit
a227ea9f
authored
Mar 21, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature' into 'dev'
标签请求匹配调整 See merge request
!260
parents
2bd519ad
a1f6dcb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
src/main/java/com/zhiwei/brandkbs2/es/EsQueryTools.java
+9
-4
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
+2
-2
No files found.
src/main/java/com/zhiwei/brandkbs2/es/EsQueryTools.java
View file @
a227ea9f
...
@@ -12,6 +12,7 @@ import org.apache.lucene.search.join.ScoreMode;
...
@@ -12,6 +12,7 @@ import org.apache.lucene.search.join.ScoreMode;
import
org.elasticsearch.index.query.*
;
import
org.elasticsearch.index.query.*
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
zhiwei
.
brandkbs2
.
common
.
GenericAttribute
.
ES_BRANDKBS_CACHE_MAPS
;
import
static
com
.
zhiwei
.
brandkbs2
.
common
.
GenericAttribute
.
ES_BRANDKBS_CACHE_MAPS
;
import
static
com
.
zhiwei
.
brandkbs2
.
util
.
Tools
.
concat
;
import
static
com
.
zhiwei
.
brandkbs2
.
util
.
Tools
.
concat
;
...
@@ -82,11 +83,15 @@ public class EsQueryTools {
...
@@ -82,11 +83,15 @@ public class EsQueryTools {
* @return
* @return
*/
*/
public
static
BoolQueryBuilder
assembleTagQuery
(
List
<
String
>
tagIds
)
{
public
static
BoolQueryBuilder
assembleTagQuery
(
List
<
String
>
tagIds
)
{
BoolQueryBuilder
tagQuery
=
QueryBuilders
.
boolQuery
();
// groupId分组处理
tagIds
.
forEach
(
e
->
{
Map
<
String
,
List
<
String
>>
groupTagIds
=
tagIds
.
stream
().
collect
(
Collectors
.
groupingBy
(
tagId
->
tagId
.
substring
(
0
,
4
)));
tagQuery
.
should
(
QueryBuilders
.
termQuery
(
"brandkbs_mark_cache_maps.unique_id.keyword"
,
e
));
BoolQueryBuilder
tagBoolQuery
=
QueryBuilders
.
boolQuery
();
groupTagIds
.
forEach
((
group
,
list
)
->
{
BoolQueryBuilder
tagQuery
=
QueryBuilders
.
boolQuery
();
list
.
forEach
(
e
->
tagQuery
.
should
(
QueryBuilders
.
termQuery
(
"brandkbs_mark_cache_maps.unique_id.keyword"
,
e
)));
tagBoolQuery
.
must
(
tagQuery
);
});
});
return
tagQuery
;
return
tag
Bool
Query
;
}
}
public
static
BoolQueryBuilder
assembleCacheMapsQuery
(
String
projectId
,
String
linkedGroupId
,
String
contendId
)
{
public
static
BoolQueryBuilder
assembleCacheMapsQuery
(
String
projectId
,
String
linkedGroupId
,
String
contendId
)
{
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/ChannelServiceImpl.java
View file @
a227ea9f
...
@@ -1041,7 +1041,7 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -1041,7 +1041,7 @@ public class ChannelServiceImpl implements ChannelService {
Long
endTime
=
timeRangeWeek
[
1
];
Long
endTime
=
timeRangeWeek
[
1
];
String
contendId
=
Constant
.
PRIMARY_CONTEND_ID
;
String
contendId
=
Constant
.
PRIMARY_CONTEND_ID
;
JSONObject
result
=
getSpreadingTend
(
channelId
,
type
,
contendId
,
startTime
,
endTime
);
JSONObject
result
=
getSpreadingTend
(
channelId
,
type
,
contendId
,
startTime
,
endTime
);
if
(
"稿
件"
.
equals
(
type
))
{
if
(
!
"事
件"
.
equals
(
type
))
{
List
<
ChannelIndex
.
Article
>
dataList
=
getSourceContendMap
(
channelId
,
Collections
.
singletonList
(
contendId
),
startTime
,
endTime
).
get
(
contendId
);
List
<
ChannelIndex
.
Article
>
dataList
=
getSourceContendMap
(
channelId
,
Collections
.
singletonList
(
contendId
),
startTime
,
endTime
).
get
(
contendId
);
int
dataSize
=
dataList
.
size
();
int
dataSize
=
dataList
.
size
();
long
positiveArticle
=
dataList
.
stream
().
filter
(
data
->
EmotionEnum
.
POSITIVE
.
getState
()
==
data
.
getEmotion
()).
count
();
long
positiveArticle
=
dataList
.
stream
().
filter
(
data
->
EmotionEnum
.
POSITIVE
.
getState
()
==
data
.
getEmotion
()).
count
();
...
@@ -1061,7 +1061,7 @@ public class ChannelServiceImpl implements ChannelService {
...
@@ -1061,7 +1061,7 @@ public class ChannelServiceImpl implements ChannelService {
},
esSearchExecutor
)).
collect
(
Collectors
.
toList
());
},
esSearchExecutor
)).
collect
(
Collectors
.
toList
());
CompletableFuture
.
allOf
(
futureList
.
toArray
(
new
CompletableFuture
[
0
])).
join
();
CompletableFuture
.
allOf
(
futureList
.
toArray
(
new
CompletableFuture
[
0
])).
join
();
result
.
put
(
"recentlyArticles"
,
futureList
.
stream
().
map
(
CompletableFuture:
:
join
).
collect
(
Collectors
.
toList
()));
result
.
put
(
"recentlyArticles"
,
futureList
.
stream
().
map
(
CompletableFuture:
:
join
).
collect
(
Collectors
.
toList
()));
}
else
if
(
"事件"
.
equals
(
type
))
{
}
else
{
Map
<
Long
,
List
<
Event
>>
eventMap
=
eventMiddlewareDao
.
getEventDay
(
new
ChannelIndex
(
channelDao
.
findOneById
(
channelId
),
contendId
).
getFid
(),
startTime
,
Map
<
Long
,
List
<
Event
>>
eventMap
=
eventMiddlewareDao
.
getEventDay
(
new
ChannelIndex
(
channelDao
.
findOneById
(
channelId
),
contendId
).
getFid
(),
startTime
,
endTime
);
endTime
);
List
<
Event
>
events
=
new
ArrayList
<>();
List
<
Event
>
events
=
new
ArrayList
<>();
...
...
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