Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
streamingUserPortrait
Project
Project
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
赵威
streamingUserPortrait
Commits
474d2adc
Commit
474d2adc
authored
4 years ago
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add second tags
parent
3ff83a9c
offic
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
4 deletions
+57
-4
Main.scala
src/main/scala/com.gmei.up/Main.scala
+9
-4
ES.scala
src/main/scala/com.gmei.up/utils/ES.scala
+46
-0
User.scala
src/main/scala/com.gmei.up/utils/User.scala
+2
-0
No files found.
src/main/scala/com.gmei.up/Main.scala
View file @
474d2adc
...
...
@@ -54,15 +54,20 @@ object Main {
stream
.
map
{
user
=>
val
projects
=
user
.
projects
.
toList
val
secondDemands
=
user
.
secondDemands
.
toList
val
secondPositions
=
user
.
secondPositions
.
toList
val
secondSolutions
=
user
.
secondSolutions
.
toList
val
cityId
=
user
.
cityId
val
deviceId
=
user
.
deviceId
println
(
deviceId
)
// println(projects.mkString(" "))
val
diaryReq
=
ES
.
generateDiaryRequest
(
projects
,
secondDemands
,
cityId
,
300
)
val
tractateReq
=
ES
.
generateTractateRequest
(
projects
,
secondDemands
,
300
)
val
answerReq
=
ES
.
generateAnswerRequest
(
projects
,
secondDemands
,
100
)
val
serviceDiaryReq
=
ES
.
generateServiceDiaryRequest
(
projects
,
secondDemands
,
cityId
,
100
)
val
diaryReq
=
ES
.
generateDiaryRequest
(
projects
,
secondDemands
,
secondPositions
,
secondSolutions
,
cityId
,
300
)
val
tractateReq
=
ES
.
generateTractateRequest
(
projects
,
secondDemands
,
secondPositions
,
secondSolutions
,
300
)
val
answerReq
=
ES
.
generateAnswerRequest
(
projects
,
secondDemands
,
secondPositions
,
secondSolutions
,
100
)
val
serviceDiaryReq
=
ES
.
generateServiceDiaryRequest
(
projects
,
secondDemands
,
secondPositions
,
secondSolutions
,
cityId
,
100
)
Redis
.
save
(
ES
.
request
(
diaryReq
),
deviceId
,
"diary"
)
Redis
.
save
(
ES
.
request
(
tractateReq
),
deviceId
,
"tractate"
)
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/com.gmei.up/utils/ES.scala
View file @
474d2adc
...
...
@@ -107,6 +107,8 @@ object ES {
def
generateDiaryRequest
(
projects
:
List
[
String
],
secondDemands
:
List
[
String
],
secondPositions
:
List
[
String
],
secondSolutions
:
List
[
String
],
cityId
:
Int
=
-
1
,
size
:
Int
=
300
)
:
SearchRequest
=
{
...
...
@@ -126,6 +128,16 @@ object ES {
shouldListBuffer
+=
TermsQuery
(
"second_demands"
,
secondDemands
)
}
if
(
secondSolutions
.
size
>
0
)
{
scoreListBuffer
+=
WeightScore
(
30
).
filter
(
termsQuery
(
"second_solutions"
,
secondSolutions
))
shouldListBuffer
+=
TermsQuery
(
"second_solutions"
,
secondSolutions
)
}
if
(
secondPositions
.
size
>
0
)
{
scoreListBuffer
+=
WeightScore
(
20
).
filter
(
termsQuery
(
"second_positions"
,
secondPositions
))
shouldListBuffer
+=
TermsQuery
(
"second_positions"
,
secondPositions
)
}
val
res
=
search
(
"gm-dbmw-diary-read"
)
.
query
{
functionScoreQuery
()
...
...
@@ -170,6 +182,8 @@ object ES {
def
generateTractateRequest
(
projects
:
List
[
String
],
secondDemands
:
List
[
String
],
secondPositions
:
List
[
String
],
secondSolutions
:
List
[
String
],
size
:
Int
=
300
)
:
SearchRequest
=
{
val
includes
=
List
(
"id"
,
"tags_v3"
)
...
...
@@ -188,6 +202,16 @@ object ES {
shouldListBuffer
+=
TermsQuery
(
"second_demands"
,
secondDemands
)
}
if
(
secondSolutions
.
size
>
0
)
{
scoreListBuffer
+=
WeightScore
(
30
).
filter
(
termsQuery
(
"second_solutions"
,
secondSolutions
))
shouldListBuffer
+=
TermsQuery
(
"second_solutions"
,
secondSolutions
)
}
if
(
secondPositions
.
size
>
0
)
{
scoreListBuffer
+=
WeightScore
(
20
).
filter
(
termsQuery
(
"second_positions"
,
secondPositions
))
shouldListBuffer
+=
TermsQuery
(
"second_positions"
,
secondPositions
)
}
val
res
=
search
(
"gm-dbmw-tractate-read"
)
.
query
{
functionScoreQuery
()
...
...
@@ -218,6 +242,8 @@ object ES {
def
generateAnswerRequest
(
projects
:
List
[
String
],
secondDemands
:
List
[
String
],
secondPositions
:
List
[
String
],
secondSolutions
:
List
[
String
],
size
:
Int
=
100
)
:
SearchRequest
=
{
val
includes
=
List
(
"id"
,
"tags_v3"
)
...
...
@@ -236,6 +262,16 @@ object ES {
shouldListBuffer
+=
TermsQuery
(
"second_demands"
,
secondDemands
)
}
if
(
secondSolutions
.
size
>
0
)
{
scoreListBuffer
+=
WeightScore
(
30
).
filter
(
termsQuery
(
"second_solutions"
,
secondSolutions
))
shouldListBuffer
+=
TermsQuery
(
"second_solutions"
,
secondSolutions
)
}
if
(
secondPositions
.
size
>
0
)
{
scoreListBuffer
+=
WeightScore
(
20
).
filter
(
termsQuery
(
"second_positions"
,
secondPositions
))
shouldListBuffer
+=
TermsQuery
(
"second_positions"
,
secondPositions
)
}
val
res
=
search
(
"gm-dbmw-answer-read"
)
.
query
{
functionScoreQuery
()
...
...
@@ -270,6 +306,8 @@ object ES {
def
generateServiceDiaryRequest
(
projects
:
List
[
String
],
secondDemands
:
List
[
String
],
secondPositions
:
List
[
String
],
secondSolutions
:
List
[
String
],
cityId
:
Int
=
-
1
,
size
:
Int
=
100
)
:
SearchRequest
=
{
...
...
@@ -283,6 +321,14 @@ object ES {
shouldListBuffer
+=
TermsQuery
(
"second_demands"
,
secondDemands
)
}
if
(
secondPositions
.
size
>
0
)
{
shouldListBuffer
+=
TermsQuery
(
"second_positions"
,
secondPositions
)
}
if
(
secondSolutions
.
size
>
0
)
{
shouldListBuffer
+=
TermsQuery
(
"second_solutions"
,
secondSolutions
)
}
val
res
=
search
(
"gm-dbmw-diary-read"
)
.
query
{
functionScoreQuery
(
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/com.gmei.up/utils/User.scala
View file @
474d2adc
...
...
@@ -7,6 +7,8 @@ case class UserInfo(
eventCn
:
String
,
cityId
:
Int
,
secondDemands
:
Array
[
String
],
secondPositions
:
Array
[
String
],
secondSolutions
:
Array
[
String
],
projects
:
Array
[
String
],
businessTags
:
Array
[
String
]
)
This diff is collapsed.
Click to expand it.
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