Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
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
钟尚武
physical
Commits
80bdfa35
Commit
80bdfa35
authored
Apr 28, 2019
by
Kai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into hk
parents
4a9fdf57
a7252c7f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
23 deletions
+13
-23
collect_data.py
linucb/views/collect_data.py
+1
-3
topic.py
search/utils/topic.py
+0
-8
tag.py
search/views/tag.py
+4
-4
topic.py
trans2es/models/topic.py
+8
-8
No files found.
linucb/views/collect_data.py
View file @
80bdfa35
...
@@ -259,9 +259,7 @@ class CollectData(object):
...
@@ -259,9 +259,7 @@ class CollectData(object):
else
:
else
:
tagid_list
=
list
()
tagid_list
=
list
()
logging
.
warning
(
"unknown type msg:
%
s"
%
raw_val_dict
.
get
(
"type"
,
"missing type"
))
logging
.
warning
(
"unknown type msg:
%
s"
%
raw_val_dict
.
get
(
"type"
,
"missing type"
))
logging
.
info
(
"consume click topic_id:
%
s,device_id:
%
s"
%
(
str
(
tagid_list
),
str
(
device_id
)))
device_id
=
raw_val_dict
[
"device"
][
"device_id"
]
device_id
=
raw_val_dict
[
"device"
][
"device_id"
]
user_id
=
raw_val_dict
[
"user_id"
]
if
"user_id"
in
raw_val_dict
else
None
user_id
=
raw_val_dict
[
"user_id"
]
if
"user_id"
in
raw_val_dict
else
None
...
...
search/utils/topic.py
View file @
80bdfa35
...
@@ -182,14 +182,6 @@ class TopicUtils(object):
...
@@ -182,14 +182,6 @@ class TopicUtils(object):
}
}
},
},
"weight"
:
1000
"weight"
:
1000
},
{
"filter"
:
{
"term"
:
{
"is_excellent"
:
1
}
},
"weight"
:
500
}
}
]
]
...
...
search/views/tag.py
View file @
80bdfa35
...
@@ -155,12 +155,12 @@ def choice_push_tag(device_id, user_id):
...
@@ -155,12 +155,12 @@ def choice_push_tag(device_id, user_id):
@bind
(
"physical/search/identity_tag_name"
)
@bind
(
"physical/search/identity_tag_name"
)
def
identity_tag_name
(
topic_content
):
def
identity_tag_name
(
topic_content
):
try
:
try
:
ret_tag_
list
=
lis
t
()
ret_tag_
set
=
se
t
()
redis_key_name
=
"physical:tag_name_set"
redis_key_name
=
"physical:tag_name_set"
body
=
{
body
=
{
'text'
:
topic_content
,
'text'
:
topic_content
,
'analyzer'
:
"gm_default_
search
"
'analyzer'
:
"gm_default_
index
"
}
}
cli_info
=
settings
.
TAG_ES_INFO_LIST
cli_info
=
settings
.
TAG_ES_INFO_LIST
...
@@ -171,9 +171,9 @@ def identity_tag_name(topic_content):
...
@@ -171,9 +171,9 @@ def identity_tag_name(topic_content):
token_word
=
item
[
"token"
]
token_word
=
item
[
"token"
]
is_member
=
redis_client
.
sismember
(
redis_key_name
,
token_word
)
is_member
=
redis_client
.
sismember
(
redis_key_name
,
token_word
)
if
is_member
:
if
is_member
:
ret_tag_
list
.
appen
d
(
token_word
)
ret_tag_
set
.
ad
d
(
token_word
)
return
{
"tag_name_list"
:
ret_tag_list
}
return
{
"tag_name_list"
:
list
(
ret_tag_set
)
}
except
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{
"tag_name_list"
:
[]}
return
{
"tag_name_list"
:
[]}
...
...
trans2es/models/topic.py
View file @
80bdfa35
...
@@ -209,7 +209,7 @@ class Topic(models.Model):
...
@@ -209,7 +209,7 @@ class Topic(models.Model):
user_query_results
=
UserExtra
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
user_id
=
self
.
user_id
)
user_query_results
=
UserExtra
.
objects
.
using
(
settings
.
SLAVE_DB_NAME
)
.
filter
(
user_id
=
self
.
user_id
)
if
user_query_results
.
count
()
>
0
:
if
user_query_results
.
count
()
>
0
:
if
user_query_results
[
0
]
.
is_recommend
:
if
user_query_results
[
0
]
.
is_recommend
:
offline_score
+=
2.0
offline_score
+=
2.0
*
10
elif
user_query_results
[
0
]
.
is_shadow
:
elif
user_query_results
[
0
]
.
is_shadow
:
user_is_shadow
=
True
user_is_shadow
=
True
...
@@ -219,18 +219,18 @@ class Topic(models.Model):
...
@@ -219,18 +219,18 @@ class Topic(models.Model):
# 帖子等级
# 帖子等级
if
self
.
content_level
==
'5'
:
if
self
.
content_level
==
'5'
:
offline_score
+=
6.0
offline_score
+=
100.0
*
3
elif
self
.
content_level
==
'4'
:
elif
self
.
content_level
==
'4'
:
offline_score
+=
5.0
offline_score
+=
60.0
*
3
elif
self
.
content_level
==
'6'
:
elif
self
.
content_level
==
'6'
:
offline_score
+=
400.0
offline_score
+=
200.0
*
3
is_excellent
=
self
.
judge_if_excellent_topic
(
self
.
id
)
#
is_excellent = self.judge_if_excellent_topic(self.id)
if
is_excellent
:
#
if is_excellent:
offline_score
+=
200.0
#
offline_score += 200.0
if
self
.
language_type
==
1
:
if
self
.
language_type
==
1
:
offline_score
+=
10
0.0
offline_score
+=
6
0.0
# exposure_count = ActionSumAboutTopic.objects.using(settings.SLAVE_DB_NAME).filter(topic_id=self.id, data_type=1).count()
# exposure_count = ActionSumAboutTopic.objects.using(settings.SLAVE_DB_NAME).filter(topic_id=self.id, data_type=1).count()
# click_count = ActionSumAboutTopic.objects.using(settings.SLAVE_DB_NAME).filter(topic_id=self.id, data_type=2).count()
# click_count = ActionSumAboutTopic.objects.using(settings.SLAVE_DB_NAME).filter(topic_id=self.id, data_type=2).count()
# uv_num = ActionSumAboutTopic.objects.using(settings.SLAVE_DB_NAME).filter(topic_id=self.id, data_type=3).count()
# uv_num = ActionSumAboutTopic.objects.using(settings.SLAVE_DB_NAME).filter(topic_id=self.id, data_type=3).count()
...
...
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