Commit efc03161 authored by lixiaofang's avatar lixiaofang

add

parents 1907bb51 91465585
......@@ -24,5 +24,29 @@
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<DBN-PSQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
</code_scheme>
</component>
\ No newline at end of file
import sys
from gm_rpcd.commands.utils import add_cwd_to_path
from gm_rpcd.internals.utils import serve
def main(args):
add_cwd_to_path()
from gm_rpcd.internals.configuration import config
config.is_develop_mode = True
config.freeze()
host = '127.0.0.1'
port = 9000
try:
first_arg = args[0]
except IndexError:
pass
else:
if ':' in first_arg:
host, port = first_arg.split(':')
port = int(port)
else:
port = int(first_arg)
print('Serving on {}:{}'.format(host, port))
serve(host=host, port=port)
if __name__ == '__main__':
main(sys.argv[1:])
......@@ -113,12 +113,10 @@ def sync_user_similar_score():
def get_tag_count():
try:
# 获取搜索推荐热词
results_registr_tag = list(
set(RegisterShowTag.objects.filter(is_deleted=False, is_online=1).values_list("tag_id", flat=True)))
results_registr_tag = list(set(RegisterShowTag.objects.filter(is_deleted=False, is_online=1).values_list("tag_id", flat=True)))
# 获取符合条件的核心词
results_tag = list(
set(Tag.objects.filter(is_online=True, is_deleted=False, collection=1).values_list("id", flat=True)))
results_tag = list(set(Tag.objects.filter(is_online=True, is_deleted=False, collection=1).values_list("id", flat=True)))
redis_registr_tag = "physical:search_hotword:results_registr_tag"
redis_tag = "physical:search_hotword:results_tag"
......
......@@ -238,14 +238,19 @@ class GroupUtils(object):
{"term": {"is_deleted": False}},
{"term": {"is_default": 0}},
{"range": {"topic_id_list": {"gte": 0}}},
{"term": {"is_cover": True}},
{"term": {"is_cover": True}}
],
"should": [
{'multi_match': multi_match}
]
],
"minimum_should_match": 1
}
}
q["_source"] = {
"includes": ["id", "is_online", "is_deleted", "is_default", "name", "description", "tag_name",
"is_cover", "offline_score", "is_default"]
"includes": ["id", "is_online", "is_deleted", "is_default", "name", "tag_name", "description",
"is_cover",
"offline_score",
"is_default"]
}
q["sort"] = [
{
......@@ -265,11 +270,9 @@ class GroupUtils(object):
}
]
logging.info("get get_search_pictorial_topic:%s" % q)
es_cli_obj = ESPerform.get_cli()
result_dict = ESPerform.get_search_results(es_cli_obj, "pictorial", q, offset, size)
logging.info("get qqqqqq:%s" % q)
logging.info("get result_dict:%s" % result_dict)
return result_dict
except:
......
......@@ -260,7 +260,7 @@ class TopicUtils(object):
query_fields = ['^'.join((k, str(v))) for (k, v) in multi_fields.items()]
multi_match = {
'query': query,
'type': 'cross_fields',
'type': 'best_fields',
'operator': 'and',
'fields': query_fields,
}
......
......@@ -104,8 +104,26 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
q = {}
# 获取帖子从属的画报
q["query"] = {
"term": {
"id": topic_id
"bool": {
"must": [
{
"term": {
"id": topic_id
}
},
{
"term": {
"is_online": True
}
}
],
"must_not": [
{
"term": {
"is_history": True
}
}
]
}
}
q["_source"] = {
......@@ -218,6 +236,7 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
def pictorial_topic_sort(pictorial_id=-1, offset=0, size=10):
"""
:remark 画报排序 人气 部分
人气按照票数从大到小排序,相同票数按照图片票数更新时间由旧到新排序
:param user_id:
:param sort_type:
:param offset:
......@@ -235,6 +254,22 @@ def pictorial_topic_sort(pictorial_id=-1, offset=0, size=10):
{"term": {"pictorial_id": pictorial_id}},
{"term": {"is_online": True}},
{"term": {"is_deleted": False}},
# {
# "nested": {
# "path": "related_billboard",
# "query": {
# "bool": {
# "must": [
# {
# "term": {
# "pictorial_id": pictorial_id
# }
# }
# ]
# }
# }
# }
# }
]
}
},
......
......@@ -51,6 +51,7 @@ def search_hotword(device_id=-1):
if len(all_tag_name_list) == 6 or num == results_tag:
break
logging.info("get all_tag_name_list:%s" % all_tag_name_list)
# 获取个性化标签
linucb_recommend_redis_prefix = "physical:linucb:tag_recommend:device_id:"
tag_recommend_redis_key = linucb_recommend_redis_prefix + str(device_id)
......@@ -61,6 +62,7 @@ def search_hotword(device_id=-1):
set(Tag.objects.filter(id=item, is_online=True).values_list("name", flat=True)))
if results_tag_recommend:
all_tag_name_list.add(results_tag_recommend[0])
logging.info("get all_tag_name_list:%s" % all_tag_name_list)
if len(all_tag_name_list) == 12:
return {"recommend_tag_name": list(all_tag_name_list)}
......@@ -74,6 +76,8 @@ def search_hotword(device_id=-1):
if results_tag_hexin:
if results_tag_hexin[0] not in all_tag_name_list:
all_tag_name_list.add(results_tag_hexin[0])
logging.info("get all_tag_name_list:%s" % all_tag_name_list)
if len(all_tag_name_list) >= 12:
return {"recommend_tag_name": list(all_tag_name_list)}
......
......@@ -114,7 +114,7 @@ def search_user(query="", offset=0, size=10):
"bool": {
"must": [
{"term": {
"nick_name_pre": query
"nick_pre": query
}
}, {
"term": {
......
......@@ -14,7 +14,7 @@
"content_level":{"type":"text"},
"user_id":{"type":"long"},
"user_nick_name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},//帖子用户名
"user_nick_name_pre": {"type":"text","index":"not_analyzed"}, //不切词的用户名
"user_nick_name_pre": {"type":"text","analyzer":"keyword"}, //不切词的用户名
"group_id":{"type":"long"}, //所在组ID
"tag_list":{"type":"long"},//标签属性
"edit_tag_list":{"type":"long"},//编辑标签
......
......@@ -55,6 +55,14 @@
},
"is_excellent":{"type": "long"},
"is_operation_home_recommend": {"type": "boolean"}, //是否首页运营推荐
"is_history": {"type": "boolean"} //是否历史数据
"is_history": {"type": "boolean"}, //是否历史数据,
"related_billboard":{
"type":"nested",
"properties":{
"pictorial_id":{"type":"long"},
"real_vote_cnt":{"type":"long"},
"virt_vote_cnt":{"type":"long"}
}
}
}
}
......@@ -4,7 +4,8 @@
"id":{"type":"long"},
"user_id":{"type":"long"},
"nick_name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"}, //昵称
"nick_name_pre":{"type":"text","index":"not_analyzed"}, //昵称
"nick_pre":{"type":"text","analyzer":"keyword"}, //昵称
"nick_name_pre":{"type":"text"}, //昵称
"profile_pic":{"type":"text"}, //头像
"gender":{"type":"integer"},
"is_online":{"type":"boolean"},//是否上线
......@@ -64,4 +65,4 @@
"update_time_val":{"type":"long"},
"count_topic":{"type":"long"}
}
}
\ No newline at end of file
}
This diff is collapsed.
......@@ -138,6 +138,9 @@ class TopicTransfer(object):
res["is_operation_home_recommend"] = True
logging.info("test topic transfer time cost,time0:%d,time1:%d,time2:%d,time3:%d,time4:%d" % (time0,time1,time2,time3,time4))
#榜单关联的投票
res["related_billboard"] = instance.get_related_billboard()
return res
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......
......@@ -42,6 +42,7 @@ class UserTransfer(object):
res["user_id"] = instance.user_id
res["nick_name"] = instance.nick_name
res["nick_name_pre"] = instance.nick_name
res["nick_pre"] = instance.nick_name
res["profile_pic"] = instance.profile_pic
res["gender"] = instance.gender
res["city_id"] = instance.city_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment