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
alpha
physical
Commits
44b6862d
Commit
44b6862d
authored
Apr 17, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add content_level 6
parent
76379c4c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
9 deletions
+9
-9
es.py
libs/es.py
+2
-2
topic.py
search/utils/topic.py
+1
-1
topic.py
search/views/topic.py
+4
-4
topic.py
trans2es/models/topic.py
+2
-2
No files found.
libs/es.py
View file @
44b6862d
...
...
@@ -280,7 +280,7 @@ class ESPerform(object):
"query"
:
{
"bool"
:
{
"must"
:
[
{
"range"
:
{
"content_level"
:
{
"gte"
:
3
,
"lte"
:
5
}}},
{
"range"
:
{
"content_level"
:
{
"gte"
:
4
,
"lte"
:
6
}}},
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_deleted"
:
False
}},
{
"terms"
:
{
"tag_list"
:
tag_id
}}
...
...
@@ -308,7 +308,7 @@ class ESPerform(object):
}
}
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
"topic"
,
query_body
=
q
,
offset
=
0
,
size
=
100
,
routing
=
"
3,4,5
"
)
offset
=
0
,
size
=
100
,
routing
=
"
4,5,6
"
)
topic_id_list
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_dict
[
"hits"
]]
logging
.
info
(
"topic_id_list:
%
s"
%
str
(
topic_id_list
))
...
...
search/utils/topic.py
View file @
44b6862d
...
...
@@ -256,7 +256,7 @@ class TopicUtils(object):
"query"
:
{
"bool"
:
{
"filter"
:
[
{
"range"
:
{
"content_level"
:
{
"gte"
:
4
,
"lte"
:
5
}}},
{
"range"
:
{
"content_level"
:
{
"gte"
:
4
,
"lte"
:
6
}}},
# {"term": {"has_image":True}},
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_deleted"
:
False
}}
...
...
search/views/topic.py
View file @
44b6862d
...
...
@@ -30,7 +30,7 @@ def get_discover_page_topic_ids(user_id, device_id, size, query_type=TopicPageTy
recommend_topic_ids
=
TopicUtils
.
get_recommend_topic_ids
(
user_id
=
user_id
,
tag_id
=
0
,
offset
=
0
,
size
=
size
,
single_size
=
size
,
query_type
=
query_type
,
filter_topic_id_list
=
have_read_topic_id_list
,
index_type
=
"topic"
,
routing
=
"4,5"
)
filter_topic_id_list
=
have_read_topic_id_list
,
index_type
=
"topic"
,
routing
=
"4,5
,6
"
)
have_read_topic_id_list
.
extend
(
recommend_topic_ids
)
...
...
@@ -113,7 +113,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
single_size
=
size
,
query
=
query
,
query_type
=
query_type
,
filter_topic_id_list
=
have_read_topic_id_list_add_promote
,
recommend_tag_list
=
recommend_topic_list
,
user_similar_score_list
=
user_similar_score_redis_list
,
index_type
=
"topic"
,
routing
=
"4,5"
,
attention_tag_list
=
attention_tag_list
)
user_similar_score_list
=
user_similar_score_redis_list
,
index_type
=
"topic"
,
routing
=
"4,5
,6
"
,
attention_tag_list
=
attention_tag_list
)
if
(
len
(
recommend_topic_list
)
==
6
):
if
(
size
<
11
):
...
...
@@ -279,7 +279,7 @@ def topic_detail_page_recommend(device_id="", user_id=-1, topic_id=-1, topic_pic
result_list
=
TopicUtils
.
get_topic_detail_recommend_list
(
user_id
,
topic_id
,
topic_tag_list
,
topic_pictorial_id
,
topic_user_id
,
filter_topic_user_id
,
have_read_topic_list
,
offset
,
size
,
es_cli_obj
,
index_type
=
"topic"
,
routing
=
"4,5"
)
have_read_topic_list
,
offset
,
size
,
es_cli_obj
,
index_type
=
"topic"
,
routing
=
"4,5
,6
"
)
recommend_topic_ids_list
=
list
()
if
len
(
result_list
)
>
0
:
recommend_topic_ids_list
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_list
]
...
...
@@ -354,7 +354,7 @@ def query_topic_by_user_similarity(topic_similarity_score_dict, offset=0, size=1
must_topic_id_list
=
list
(
topic_similarity_score_dict
.
keys
())
topic_id_list
=
TopicUtils
.
get_recommend_topic_ids
(
tag_id
=
0
,
user_id
=-
1
,
offset
=
offset
,
size
=
size
,
single_size
=
size
,
must_topic_id_list
=
must_topic_id_list
,
index_type
=
"topic"
,
routing
=
"4,5"
)
must_topic_id_list
=
must_topic_id_list
,
index_type
=
"topic"
,
routing
=
"4,5
,6
"
)
return
{
"recommend_topic_ids"
:
topic_id_list
}
except
:
...
...
trans2es/models/topic.py
View file @
44b6862d
...
...
@@ -197,8 +197,8 @@ class Topic(models.Model):
offline_score
+=
6.0
elif
self
.
content_level
==
'4'
:
offline_score
+=
5.0
elif
self
.
content_level
==
'
3
'
:
offline_score
+=
2
.0
elif
self
.
content_level
==
'
6
'
:
offline_score
+=
100
.0
# 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()
...
...
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