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
8c26d279
Commit
8c26d279
authored
Aug 07, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
highlight
parent
05a61dff
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
8 deletions
+30
-8
misc.xml
.idea/misc.xml
+1
-1
physical.iml
.idea/physical.iml
+1
-1
es.py
libs/es.py
+10
-0
topic.py
search/utils/topic.py
+15
-5
topic.py
search/views/topic.py
+3
-1
No files found.
.idea/misc.xml
View file @
8c26d279
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.6 (
physical1
)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.6 (
LiXiaoFang
)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"PyCharmProfessionalAdvertiser"
>
<option
name=
"shown"
value=
"true"
/>
</component>
...
...
.idea/physical.iml
View file @
8c26d279
...
...
@@ -2,7 +2,7 @@
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.6 (
physical1
)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.6 (
LiXiaoFang
)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
<component
name=
"TestRunnerService"
>
...
...
libs/es.py
View file @
8c26d279
...
...
@@ -446,3 +446,13 @@ class ESPerform(object):
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
list
()
@classmethod
def
get_highlight
(
cls
,
fields
=
[]):
field_highlight
=
{
'fields'
:
{
k
:
{}
for
k
in
fields
},
'pre_tags'
:
[
'<
%
s>'
%
'ems'
],
'post_tags'
:
[
'</
%
s>'
%
'ems'
]
}
return
field_highlight
search/utils/topic.py
View file @
8c26d279
...
...
@@ -324,6 +324,15 @@ class TopicUtils(object):
}
}
]
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
index_type
,
query_body
=
q
,
offset
=
offset
,
size
=
size
,
routing
=
routing
)
topic_id_list
=
list
()
for
item
in
result_dict
[
"hits"
]:
topic_id_list
.
append
(
item
[
"_source"
][
"id"
])
else
:
multi_match
=
{
'query'
:
query
,
...
...
@@ -406,13 +415,14 @@ class TopicUtils(object):
}
]
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
index_type
,
query_body
=
q
,
offset
=
offset
,
size
=
size
,
routing
=
routing
)
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
index_type
,
query_body
=
q
,
offset
=
offset
,
size
=
size
,
routing
=
routing
)
topic_id_list
=
list
()
topic_id_list
=
list
()
for
item
in
result_dict
[
"hits"
]:
topic_id_list
.
append
({
"id"
:
item
[
"_source"
][
"id"
],
"highlight"
:
item
[
"highlight"
]})
for
item
in
result_dict
[
"hits"
]:
topic_id_list
.
append
(
item
[
"_source"
][
"id"
])
return
topic_id_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
...
search/views/topic.py
View file @
8c26d279
...
...
@@ -183,7 +183,9 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
# topic_id_list.extend(recommend_topic_list[3:6])
# else:
# topic_id_list.extend(rank_topic_id_list)
have_read_topic_id_list
.
extend
(
rank_topic_id_list
)
logging
.
info
(
"get rank_topic_id_list:
%
s"
%
rank_topic_id_list
)
logging
.
info
(
"get item:
%
s"
%
item
[
"id"
]
for
item
in
rank_topic_id_list
)
have_read_topic_id_list
.
extend
(
item
[
"id"
]
for
item
in
rank_topic_id_list
)
if
len
(
have_read_topic_id_list
)
>
30000
:
cut_len
=
len
(
have_read_topic_id_list
)
-
30000
have_read_topic_id_list
=
have_read_topic_id_list
[
cut_len
:]
...
...
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