Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
488a1b72
Commit
488a1b72
authored
Aug 04, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
热度算法优化 参数
parent
58b6eaec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+10
-8
application-dev.yml
community-service/src/main/resources/application-dev.yml
+6
-1
No files found.
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
488a1b72
...
@@ -48,17 +48,19 @@ public class RankService {
...
@@ -48,17 +48,19 @@ public class RankService {
@Value
(
"${rank.theme.initialWeight:1.0}"
)
@Value
(
"${rank.theme.initialWeight:1.0}"
)
public
Double
initialWeight
;
public
Double
initialWeight
;
//时间系数
//时间系数
@Value
(
"${rank.theme.timeRate
n
:0.2}"
)
@Value
(
"${rank.theme.timeRate:0.2}"
)
public
Double
timeRate
;
public
Double
timeRate
;
@Value
(
"${rank.topic.viewRate:1}"
)
@Value
(
"${rank.topic.viewRate:1}"
)
public
Double
viewRateTopic
;
public
Double
topicViewRate
;
@Value
(
"${rank.topic.discussRate:3}"
)
@Value
(
"${rank.topic.discussRate:3}"
)
public
Double
discussRateTopic
;
public
Double
topicDiscussRate
;
@Value
(
"${rank.topic.themeRate:1}"
)
public
Double
topicThemeRate
;
//时间系数
//时间系数
@Value
(
"${rank.theme.timeRate
n
:1}"
)
@Value
(
"${rank.theme.timeRate:1}"
)
public
Double
t
imeRateTopic
;
public
Double
t
opicTimeRate
;
@Autowired
@Autowired
private
ThemeService
themeService
;
private
ThemeService
themeService
;
...
@@ -267,9 +269,9 @@ public class RankService {
...
@@ -267,9 +269,9 @@ public class RankService {
if
(
topic
.
getIsTop
()
>
0
)
{
if
(
topic
.
getIsTop
()
>
0
)
{
topic
.
setScore
(
Double
.
MAX_VALUE
);
topic
.
setScore
(
Double
.
MAX_VALUE
);
}
}
Double
socre
=
((
topic
.
getDisscussCount
()
*
discussRateTopic
+
topic
.
getViewCount
()
*
viewRateTopic
)
Double
socre
=
((
topic
.
getDisscussCount
()
*
topicDiscussRate
+
topic
.
getViewCount
()
*
topicViewRate
)
/
Math
.
pow
(
topic
.
getHoursTillNow
()
+
1
,
t
imeRateTopic
))
/
Math
.
pow
(
topic
.
getHoursTillNow
()
+
1
,
t
opicTimeRate
))
+
topic
.
getThemeWeight
();
+
topic
.
getThemeWeight
()
*
topicThemeRate
;
topic
.
setScore
(
socre
);
topic
.
setScore
(
socre
);
}
}
}
}
community-service/src/main/resources/application-dev.yml
View file @
488a1b72
...
@@ -105,4 +105,9 @@ rank:
...
@@ -105,4 +105,9 @@ rank:
collectRatio
:
3
collectRatio
:
3
userWeightRatio
:
0.9
userWeightRatio
:
0.9
initialWeight
:
1.0
initialWeight
:
1.0
timeRation
:
0.2
timeRation
:
0.2
\ No newline at end of file
topic
:
viewRate
:
2
discussRate
:
3
themeRate
:
3
timeRate
:
1
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