Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
searchhotcrawler
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
zhiwei
searchhotcrawler
Commits
a0333434
Commit
a0333434
authored
Jun 04, 2020
by
zhiwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复计算热搜排名由于历史数据错误导致的当前数据错误问题,并添加上一次的排名及热度功能
parent
64bf0be4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
+7
-1
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
+7
-1
No files found.
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
View file @
a0333434
...
...
@@ -68,7 +68,6 @@ public class HotSearchCacheDAO {
boolean
hot
=
document
.
getBoolean
(
"hot"
)!=
null
?
document
.
getBoolean
(
"hot"
):
true
;
String
url
=
document
.
getString
(
"url"
)!=
null
?
document
.
getString
(
"url"
):
null
;
String
id
=
name
+
"_"
+
type
;
Document
query
=
new
Document
(
"_id"
,
id
);
Document
nowDoc
=
(
Document
)
collection
.
find
(
query
).
first
();
if
(
Objects
.
nonNull
(
nowDoc
))
{
...
...
@@ -79,6 +78,9 @@ public class HotSearchCacheDAO {
highestCount
=
lastCount
;
}
//判断最高排名
if
(
highestRank
<
0
){
highestRank
=
lastRank
;
}
if
(
lastRank
>
0
&&
highestRank
>
0
&&
lastRank
<
highestRank
)
{
highestRank
=
lastRank
;
}
...
...
@@ -92,6 +94,8 @@ public class HotSearchCacheDAO {
nowDoc
.
put
(
"lastCount"
,
lastCount
);
nowDoc
.
put
(
"highestRank"
,
highestRank
);
nowDoc
.
put
(
"highestCount"
,
highestCount
);
nowDoc
.
put
(
"preRank"
,
null
);
nowDoc
.
put
(
"preCount"
,
null
);
nowDoc
.
put
(
"duration"
,
durationNow
);
collection
.
replaceOne
(
query
,
nowDoc
);
}
else
{
...
...
@@ -110,6 +114,8 @@ public class HotSearchCacheDAO {
nowDoc
.
put
(
"startTime"
,
startTime
);
nowDoc
.
put
(
"endTime"
,
endTime
);
nowDoc
.
put
(
"duration"
,
durationNow
);
nowDoc
.
put
(
"preRank"
,
nowDoc
.
getInteger
(
"lastRank"
));
nowDoc
.
put
(
"preCount"
,
nowDoc
.
getInteger
(
"lastCount"
));
collection
.
insertOne
(
nowDoc
);
}
...
...
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