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
abf949d0
Commit
abf949d0
authored
Nov 30, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
dd859d9a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
es.py
libs/es.py
+1
-0
topic.py
search/views/topic.py
+23
-0
No files found.
libs/es.py
View file @
abf949d0
...
...
@@ -165,6 +165,7 @@ class ESPerform(object):
cls
.
create_index
(
es_cli
,
sub_index_name
)
cls
.
put_index_mapping
(
es_cli
,
sub_index_name
)
logging
.
info
(
"duan add,query_body:
%
s"
%
str
(
query_body
)
.
encode
(
"utf-8"
))
res
=
es_cli
.
search
(
index
=
official_index_name
,
doc_type
=
doc_type
,
body
=
query_body
,
from_
=
offset
,
size
=
size
)
result_dict
=
{
"total_count"
:
res
[
"hits"
][
"total"
],
...
...
search/views/topic.py
View file @
abf949d0
...
...
@@ -17,6 +17,8 @@ def home_recommend(user_id=-1,offset=0,size=10):
:return:
"""
try
:
if
not
user_id
:
user_id
=-
1
redis_key
=
"physical:home_recommend:"
+
"user_id:"
+
str
(
user_id
)
redis_val_dict
=
redis_client
.
hgetall
(
redis_key
)
if
len
(
redis_val_dict
)
>
0
:
...
...
@@ -74,6 +76,8 @@ def home_query(user_id=-1,query="",offset=0,size=10):
:return:
"""
try
:
if
not
user_id
:
user_id
=-
1
redis_key
=
"physical:home_query:"
+
"user_id:"
+
str
(
user_id
)
redis_val_dict
=
redis_client
.
hgetall
(
redis_key
)
if
len
(
redis_val_dict
)
>
0
:
...
...
@@ -120,3 +124,22 @@ def home_query(user_id=-1,query="",offset=0,size=10):
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{
"recommend_topic_ids"
:
[]}
@bind
(
"physical/search/topic_detail_page_recommend"
)
def
topic_detail_page_recommend
(
user_id
=-
1
,
topic_id
=-
1
,
topic_group_id
=-
1
,
topic_user_id
=-
1
,
offset
=
0
,
size
=
10
):
"""
:remark:帖子详情页推荐策略
:param user_id:
:param topic_id:
:param topic_group_id:
:param topic_user_id:
:return:
"""
try
:
return
{
"recommend_topic_ids"
:
[]}
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{
"recommend_topic_ids"
:
[]}
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