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
086b6ef5
Commit
086b6ef5
authored
Apr 30, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'test'
Master See merge request
alpha/physical!323
parents
39ab9298
5156c4fa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
24 deletions
+18
-24
collect_data.py
linucb/views/collect_data.py
+2
-0
topic.py
search/utils/topic.py
+2
-9
business_topic.py
search/views/business_topic.py
+0
-1
type_info.py
trans2es/type_info.py
+14
-14
No files found.
linucb/views/collect_data.py
View file @
086b6ef5
...
...
@@ -32,7 +32,9 @@ class CollectData(object):
def
__init__
(
self
):
self
.
linucb_matrix_redis_prefix
=
"physical:linucb:device_id:"
#废弃
self
.
linucb_recommend_redis_prefix
=
"physical:linucb:tag_recommend:device_id:"
#推荐帖子
self
.
linucb_recommend_topic_id_prefix
=
"physical:linucb:topic_recommend:device_id:"
self
.
tag_topic_id_redis_prefix
=
"physical:tag_id:topic_id_list:"
self
.
click_recommend_redis_key_prefix
=
"physical:click_recommend:device_id:"
...
...
search/utils/topic.py
View file @
086b6ef5
...
...
@@ -284,7 +284,8 @@ class TopicUtils(object):
query_function_score
[
"query"
][
"bool"
][
"should"
]
=
[
{
'multi_match'
:
multi_match
},
{
"term"
:
{
"tag_list"
:
tag_id
}}
{
"term"
:
{
"tag_list"
:
tag_id
}},
{
"term"
:
{
"user_nick_name"
:
query
}}
]
query_function_score
[
"query"
][
"bool"
][
"minimum_should_match"
]
=
1
else
:
...
...
@@ -694,12 +695,6 @@ class TopicUtils(object):
"term"
:
{
k
:
v
},
})
if
k
==
"is_complaint"
:
f
.
append
({
"term"
:
{
k
:
v
},
})
if
v
in
(
None
,
''
,
[]):
continue
...
...
@@ -922,7 +917,6 @@ class TopicUtils(object):
}
}
}
}
if
query
==
''
:
q
[
"query"
]
=
{
...
...
@@ -930,7 +924,6 @@ class TopicUtils(object):
"must"
:
must
,
"must_not"
:
cls
.
process_nfilters
(
nfilters
),
}
}
if
sorts_by
:
...
...
search/views/business_topic.py
View file @
086b6ef5
...
...
@@ -25,7 +25,6 @@ def business_topic_search(filters, nfilters=None, sorts_by=None, offset=0, size=
index_name
=
"topic"
)
logging
.
info
(
"get result_lsit:
%
s"
%
result_list
)
topic_ids
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_list
[
"hits"
]]
return
{
"topic_ids"
:
topic_ids
,
"total_count"
:
result_list
[
"total_count"
]}
except
:
...
...
trans2es/type_info.py
View file @
086b6ef5
...
...
@@ -161,20 +161,20 @@ class TypeInfo(object):
ori_topic_star
=
redis_client
.
hget
(
self
.
physical_topic_star
,
data
[
"id"
])
if
ori_topic_star
:
ori_topic_star
=
str
(
ori_topic_star
,
encoding
=
"utf-8"
)
else
:
q
=
{
"query"
:{
"term"
:{
"id"
:
data
[
"id"
]
}
},
"_source"
:{
"includes"
:[
"content_level"
]
}
}
search_results
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
"topic-star"
,
query_body
=
q
,
offset
=
0
,
size
=
1
)
if
len
(
search_results
[
"hits"
])
>
0
:
ori_topic_star
=
search_results
[
"hits"
][
0
][
"_source"
][
"content_level"
]
#
else:
#
q = {
#
"query":{
#
"term":{
#
"id": data["id"]
#
}
#
},
#
"_source":{
#
"includes":["content_level"]
#
}
#
}
#
search_results = ESPerform.get_search_results(ESPerform.get_cli(),sub_index_name="topic-star",query_body=q,offset=0,size=1)
#
if len(search_results["hits"]) > 0:
#
ori_topic_star = search_results["hits"][0]["_source"]["content_level"]
if
not
ori_topic_star
:
# data_list = [
...
...
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