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
Show 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):
...
@@ -32,7 +32,9 @@ class CollectData(object):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
linucb_matrix_redis_prefix
=
"physical:linucb:device_id:"
self
.
linucb_matrix_redis_prefix
=
"physical:linucb:device_id:"
#废弃
self
.
linucb_recommend_redis_prefix
=
"physical:linucb:tag_recommend: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
.
linucb_recommend_topic_id_prefix
=
"physical:linucb:topic_recommend:device_id:"
self
.
tag_topic_id_redis_prefix
=
"physical:tag_id:topic_id_list:"
self
.
tag_topic_id_redis_prefix
=
"physical:tag_id:topic_id_list:"
self
.
click_recommend_redis_key_prefix
=
"physical:click_recommend:device_id:"
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):
...
@@ -284,7 +284,8 @@ class TopicUtils(object):
query_function_score
[
"query"
][
"bool"
][
"should"
]
=
[
query_function_score
[
"query"
][
"bool"
][
"should"
]
=
[
{
'multi_match'
:
multi_match
},
{
'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
query_function_score
[
"query"
][
"bool"
][
"minimum_should_match"
]
=
1
else
:
else
:
...
@@ -694,12 +695,6 @@ class TopicUtils(object):
...
@@ -694,12 +695,6 @@ class TopicUtils(object):
"term"
:
{
k
:
v
},
"term"
:
{
k
:
v
},
})
})
if
k
==
"is_complaint"
:
f
.
append
({
"term"
:
{
k
:
v
},
})
if
v
in
(
None
,
''
,
[]):
if
v
in
(
None
,
''
,
[]):
continue
continue
...
@@ -922,7 +917,6 @@ class TopicUtils(object):
...
@@ -922,7 +917,6 @@ class TopicUtils(object):
}
}
}
}
}
}
}
}
if
query
==
''
:
if
query
==
''
:
q
[
"query"
]
=
{
q
[
"query"
]
=
{
...
@@ -930,7 +924,6 @@ class TopicUtils(object):
...
@@ -930,7 +924,6 @@ class TopicUtils(object):
"must"
:
must
,
"must"
:
must
,
"must_not"
:
cls
.
process_nfilters
(
nfilters
),
"must_not"
:
cls
.
process_nfilters
(
nfilters
),
}
}
}
}
if
sorts_by
:
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=
...
@@ -25,7 +25,6 @@ def business_topic_search(filters, nfilters=None, sorts_by=None, offset=0, size=
index_name
=
"topic"
index_name
=
"topic"
)
)
logging
.
info
(
"get result_lsit:
%
s"
%
result_list
)
topic_ids
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_list
[
"hits"
]]
topic_ids
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_list
[
"hits"
]]
return
{
"topic_ids"
:
topic_ids
,
"total_count"
:
result_list
[
"total_count"
]}
return
{
"topic_ids"
:
topic_ids
,
"total_count"
:
result_list
[
"total_count"
]}
except
:
except
:
...
...
trans2es/type_info.py
View file @
086b6ef5
...
@@ -161,20 +161,20 @@ class TypeInfo(object):
...
@@ -161,20 +161,20 @@ class TypeInfo(object):
ori_topic_star
=
redis_client
.
hget
(
self
.
physical_topic_star
,
data
[
"id"
])
ori_topic_star
=
redis_client
.
hget
(
self
.
physical_topic_star
,
data
[
"id"
])
if
ori_topic_star
:
if
ori_topic_star
:
ori_topic_star
=
str
(
ori_topic_star
,
encoding
=
"utf-8"
)
ori_topic_star
=
str
(
ori_topic_star
,
encoding
=
"utf-8"
)
else
:
#
else:
q
=
{
#
q = {
"query"
:{
#
"query":{
"term"
:{
#
"term":{
"id"
:
data
[
"id"
]
#
"id": data["id"]
}
#
}
},
#
},
"_source"
:{
#
"_source":{
"includes"
:[
"content_level"
]
#
"includes":["content_level"]
}
#
}
}
#
}
search_results
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
"topic-star"
,
query_body
=
q
,
offset
=
0
,
size
=
1
)
#
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
:
#
if len(search_results["hits"]) > 0:
ori_topic_star
=
search_results
[
"hits"
][
0
][
"_source"
][
"content_level"
]
#
ori_topic_star = search_results["hits"][0]["_source"]["content_level"]
if
not
ori_topic_star
:
if
not
ori_topic_star
:
# data_list = [
# 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