Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
mentha
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
1
Merge Requests
1
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
rank
mentha
Commits
79934903
Commit
79934903
authored
Jan 18, 2021
by
李小芳
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hot_score' into 'master'
Hot score See merge request
!30
parents
b6b5e3f6
3ff57bb7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
5 deletions
+47
-5
transfer.py
data_sync/answer/transfer.py
+4
-1
answer.py
qa/models/answer.py
+43
-4
No files found.
data_sync/answer/transfer.py
View file @
79934903
...
...
@@ -62,8 +62,11 @@ def get_answers(pks):
item
[
'new_smr'
]
=
answer
.
get_new_smart_rank_score
(
answer_id
=
answer
.
id
)
score
=
answer
.
get_search_new_smart_rank_score
(
answer_id
=
answer
.
id
)
item
[
'search_new_smr'
]
=
score
.
get
(
"smart_rank_score"
,
0
)
item
[
'new_goodclicks'
]
=
score
.
get
(
'new_goodclick'
,
0
)
item
[
'detail_smr'
]
=
score
.
get
(
'smart_rank_v2'
,
0
)
# community_score = answer.get_community_answer_smr_score(answer.id)
community_hot_score
=
answer
.
get_community_answer_hot_score
(
answer
.
id
)
item
[
'new_goodclicks'
]
=
community_hot_score
.
get
(
'hot_score'
,
0
)
item
[
'platform'
]
=
answer
.
platform
# 新标签
...
...
qa/models/answer.py
View file @
79934903
...
...
@@ -1032,10 +1032,6 @@ class Answer(models.Model):
def
get_search_new_smart_rank_score
(
self
,
answer_id
):
try
:
today
=
datetime
.
datetime
.
now
()
.
date
()
delta
=
datetime
.
timedelta
(
days
=
1
)
n_days
=
today
-
delta
date_change
=
str
(
n_days
)
.
replace
(
"-"
,
""
)
score
=
SearchStrategyAnswerSmrScore
.
objects
.
using
(
settings
.
DORIS_DB_NAME
)
.
filter
(
answer_id
=
answer_id
)
.
order_by
(
'-create_date'
)
.
values
(
"smart_rank_score"
,
"new_goodclick"
,
"smart_rank_v2"
)
.
first
()
...
...
@@ -1047,6 +1043,30 @@ class Answer(models.Model):
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{}
def
get_community_answer_smr_score
(
self
,
answer_id
):
try
:
score
=
CommunitysStrategyAnswerSmrScore
.
objects
.
using
(
settings
.
DORIS_DB_NAME
)
.
filter
(
answer_id
=
answer_id
)
.
order_by
(
'-create_date'
)
.
values
(
"smart_rank_score"
)
.
first
()
if
score
:
return
score
else
:
return
{}
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{}
def
get_community_answer_hot_score
(
self
,
answer_id
):
try
:
score
=
CommunitysStrategyAnswerHotScore
.
objects
.
using
(
settings
.
DORIS_DB_NAME
)
.
filter
(
answer_id
=
answer_id
)
.
order_by
(
'-create_date'
)
.
values
(
"hot_score"
)
.
first
()
if
score
:
return
score
else
:
return
{}
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{}
def
get_answer_show_by_index
(
self
,
answer_id
):
try
:
from
talos.models.tractate.tractate
import
StrategyContentExposureIndex
...
...
@@ -1725,3 +1745,22 @@ class SearchStrategyAnswerSmrScore(models.Model):
create_date
=
models
.
BigIntegerField
(
max_length
=
50
,
verbose_name
=
"时间"
)
new_goodclick
=
models
.
FloatField
(
verbose_name
=
u'新的点击分'
,
blank
=
True
,
default
=
0
)
smart_rank_v2
=
models
.
FloatField
(
verbose_name
=
u'新的smr_score'
,
blank
=
True
,
default
=
0
)
class
CommunitysStrategyAnswerSmrScore
(
models
.
Model
):
class
Meta
:
db_table
=
'communitys_strategy_answer_smr_score'
answer_id
=
models
.
IntegerField
(
unique
=
True
)
smart_rank_score
=
models
.
FloatField
(
verbose_name
=
u'新的smr_score'
,
blank
=
True
,
default
=
0
)
create_date
=
models
.
BigIntegerField
(
max_length
=
50
,
verbose_name
=
"时间"
)
good_click
=
models
.
FloatField
(
verbose_name
=
u'热度'
,
blank
=
True
,
default
=
0
)
class
CommunitysStrategyAnswerHotScore
(
models
.
Model
):
class
Meta
:
db_table
=
'communitys_strategy_answer_hot_score'
answer_id
=
models
.
IntegerField
(
unique
=
True
)
create_date
=
models
.
BigIntegerField
(
max_length
=
50
,
verbose_name
=
"时间"
)
hot_score
=
models
.
FloatField
(
verbose_name
=
u'热度'
,
blank
=
True
,
default
=
0
)
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