Commit cdde760f authored by lixiaofang's avatar lixiaofang

add

parent 99d7e098
......@@ -47,28 +47,29 @@ class GroupUtils(object):
return {"total_count": 0, "hits": []}
@classmethod
def get_hot_pictorial_recommend_result_list(cls, offset, size, es_cli_obj=None):
def get_hot_pictorial_recommend_result_list(cls,offset,size,es_cli_obj=None):
try:
if not es_cli_obj:
es_cli_obj = ESPerform.get_cli()
q = dict()
q["query"] = {
"bool": {
"must": [
"bool":{
"must":[
{"term": {"is_online": True}},
{"term": {"is_deleted": False}}
{"term":{"is_deleted": False}},
{"term": {"effective": True}}
]
}
}
q["sort"] = [
{"high_quality_topic_num": {"order": "desc"}}
{"high_quality_topic_num":{"order":"desc"}}
]
q["_source"] = {
"includes": ["id"]
"includes":["id"]
}
result_dict = ESPerform.get_search_results(es_cli_obj, "pictorial", offset ,size)
result_dict = ESPerform.get_search_results(es_cli_obj,"pictorial",q,offset,size)
pictorial_ids_list = []
if len(result_dict["hits"]) > 0:
......@@ -95,26 +96,26 @@ class GroupUtils(object):
"must": [
{"term": {"is_online": True}},
{"term": {"user_id": user_id}},
{"term": {"is_deleted": False}}
{"term": {"is_deleted": False}},
{"term":{"effective":True}}
]
}
}
q["_source"] = {
"includes": ["attention_pictorial_id_list"]
}
MAX_LOAD = 1000
sizes = max(size, MAX_LOAD)
result_dict = ESPerform.get_search_results(es_cli_obj, "user", q, offset=0, size=sizes)
pictorial_ids_list = []
result_dict = ESPerform.get_search_results(es_cli_obj, "user", q, offset, size)
if len(result_dict["hits"]) > 0:
pictorial_ids_list = result_dict["hits"][0]["_source"]["attention_pictorial_id_list"]
return result_dict["hits"][0]["_source"]["attention_pictorial_id_list"]
else:
return []
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return []
@classmethod
def get_pictorial_ids_by_aggs(cls, pictorial_ids_list, es_cli_obj=None):
"""
......
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