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
4ce93bae
Commit
4ce93bae
authored
Apr 22, 2019
by
Kai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into hk
parents
422942a0
e043da6c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
41 deletions
+31
-41
topic.py
search/utils/topic.py
+25
-36
group.py
search/views/group.py
+2
-1
tag.py
search/views/tag.py
+4
-4
No files found.
search/utils/topic.py
View file @
4ce93bae
...
@@ -331,37 +331,9 @@ class TopicUtils(object):
...
@@ -331,37 +331,9 @@ class TopicUtils(object):
offset
=
offset
,
size
=
size
,
routing
=
routing
)
offset
=
offset
,
size
=
size
,
routing
=
routing
)
topic_id_list
=
list
()
topic_id_list
=
list
()
same_group_id_set
=
set
()
same_user_id_set
=
set
()
for
item
in
result_dict
[
"hits"
]:
for
item
in
result_dict
[
"hits"
]:
topic_id_list
.
append
(
item
[
"_source"
][
"id"
])
topic_id_list
.
append
(
item
[
"_source"
][
"id"
])
# for item in result_dict["hits"]:
# if item["_source"]["group_id"]>0 and item["_source"]["group_id"] not in same_group_id_set:
# same_group_id_set.add(item["_source"]["id"])
# topic_id_list.append(item["_source"]["id"])
# else:
# same_group_id_set.add(item["_source"]["id"])
#
# if item["_source"]["user_id"] not in same_user_id_set:
# same_user_id_set.add(item["_source"]["id"])
# topic_id_list.append(item["_source"]["id"])
# else:
# same_user_id_set.add(item["_source"]["id"])
#
# if len(topic_id_list) >= single_size:
# break
#
# if len(topic_id_list) < single_size:
# for topic_id in same_group_id_set:
# topic_id_list.append(topic_id)
# if len(topic_id_list)>=single_size:
# break
# for topic_id in same_user_id_set:
# topic_id_list.append(topic_id)
# if len(topic_id_list)>=single_size:
# break
logging
.
info
(
"topic_id_list:
%
s,attention_tag_list
%
s"
%
(
str
(
topic_id_list
),
str
(
attention_tag_list
)))
return
topic_id_list
return
topic_id_list
except
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
@@ -634,20 +606,37 @@ class TopicUtils(object):
...
@@ -634,20 +606,37 @@ class TopicUtils(object):
}
}
}
}
})
})
elif
k
.
endswith
(
"__exclude"
):
filed
=
k
[:
-
5
]
op
=
"lt"
f
.
append
({
"range"
:
{
filed
:
{
op
:
v
,
}
}
})
op
=
"gt"
f
.
append
({
"range"
:
{
filed
:
{
op
:
v
,
}
}
})
elif
k
.
startswith
(
"__gte"
)
or
k
.
startswith
(
"__lte"
)
or
\
elif
k
.
endswith
(
"__gte"
)
or
k
.
endswith
(
"__lte"
)
or
k
.
endswith
(
"__gt"
)
or
k
.
endswith
(
"__lt"
):
k
.
startswith
(
"__gt"
)
or
k
.
startswith
(
"__lt"
):
if
k
.
endswith
(
"__gte"
):
if
k
.
startswith
(
"__gte"
):
op
=
"gte"
op
=
"gte"
filed
=
k
[:
-
5
]
filed
=
k
[:
-
5
]
elif
k
==
"__lte"
:
elif
k
.
endswith
(
"__lte"
)
:
op
=
"lte"
op
=
"lte"
filed
=
k
[:
-
5
]
filed
=
k
[:
-
5
]
elif
k
==
"__gt"
:
elif
k
.
endswith
(
"__gt"
)
:
op
=
"
lte
"
op
=
"
gt
"
filed
=
k
[:
-
4
]
filed
=
k
[:
-
4
]
elif
k
==
"__lt"
:
elif
k
.
endswith
(
"__lt"
)
:
op
=
"lt
e
"
op
=
"lt"
filed
=
k
[:
-
4
]
filed
=
k
[:
-
4
]
f
.
append
({
f
.
append
({
...
...
search/views/group.py
View file @
4ce93bae
...
@@ -225,9 +225,10 @@ def pictorial_topic_sort(pictorial_id=-1, offset=0, size=10):
...
@@ -225,9 +225,10 @@ def pictorial_topic_sort(pictorial_id=-1, offset=0, size=10):
}
}
},
},
"sort"
:[
"sort"
:[
{
"total_vote_num"
:
{
"order"
:
"desc"
}},
{
"total_vote_num"
:
{
"order"
:
"desc"
}},
{
"create_time"
:
{
"order"
:
"desc"
}}
{
"create_time"
:
{
"order"
:
"desc"
}}
]
]
}
}
pict_pictorial_ids_list
=
[]
pict_pictorial_ids_list
=
[]
# 获取es链接对象
# 获取es链接对象
...
...
search/views/tag.py
View file @
4ce93bae
...
@@ -118,8 +118,8 @@ def choice_push_tag(device_id, user_id):
...
@@ -118,8 +118,8 @@ def choice_push_tag(device_id, user_id):
redis_push_tag_dict
.
popitem
(
tag_id
)
redis_push_tag_dict
.
popitem
(
tag_id
)
redis_push_tag_list
=
list
(
redis_push_tag_dict
.
keys
())
redis_push_tag_list
=
list
(
redis_push_tag_dict
.
keys
())
account_user_tag_list
=
AccountUserTag
.
objects
.
filter
(
user
=
user_id
)
.
values_list
(
"tag_id"
,
flat
=
True
)
account_user_tag_list
=
list
(
AccountUserTag
.
objects
.
filter
(
user
=
user_id
)
.
values_list
(
"tag_id"
,
flat
=
True
)
)
community_tag_follow_list
=
CommunityTagFollow
.
objects
.
filter
(
user_id
=
user_id
)
.
values_list
(
"tag_id"
,
flat
=
True
)
community_tag_follow_list
=
list
(
CommunityTagFollow
.
objects
.
filter
(
user_id
=
user_id
)
.
values_list
(
"tag_id"
,
flat
=
True
)
)
linucb_recommend_redis_prefix
=
"physical:linucb:tag_recommend:device_id:"
linucb_recommend_redis_prefix
=
"physical:linucb:tag_recommend:device_id:"
tag_recommend_redis_key
=
linucb_recommend_redis_prefix
+
str
(
device_id
)
tag_recommend_redis_key
=
linucb_recommend_redis_prefix
+
str
(
device_id
)
...
@@ -134,10 +134,10 @@ def choice_push_tag(device_id, user_id):
...
@@ -134,10 +134,10 @@ def choice_push_tag(device_id, user_id):
if
len
(
unread_tag_list
)
>
0
:
if
len
(
unread_tag_list
)
>
0
:
for
tag_id
in
unread_tag_list
:
for
tag_id
in
unread_tag_list
:
valid_tag_topic_num
=
TopicTag
.
objects
.
filter
(
tag_id
=
tag_id
,
is_online
=
True
)
.
count
()
valid_tag_topic_num
=
TopicTag
.
objects
.
filter
(
tag_id
=
tag_id
,
is_online
=
True
)
.
count
()
if
valid_tag_topic_num
>
10
0
:
if
valid_tag_topic_num
>
0
:
ret_tag_set
.
add
(
tag_id
)
ret_tag_set
.
add
(
tag_id
)
redis_push_tag_dict
[
tag_id
]
=
now_sec
redis_push_tag_dict
[
tag_id
]
=
now_sec
if
len
(
ret_tag_set
)
>=
2
:
if
len
(
ret_tag_set
)
>=
1
:
break
break
redis_client
.
set
(
redis_push_tag_key
,
json
.
dumps
(
redis_push_tag_dict
))
redis_client
.
set
(
redis_push_tag_key
,
json
.
dumps
(
redis_push_tag_dict
))
...
...
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