Commit cc3dc3ab authored by litaolemo's avatar litaolemo

update

parent 187154b5
......@@ -57,7 +57,7 @@ def user_portrait_scan_info():
# user_portrait_get_empty_candidates(device_id)
try:
res_dic = get_user_portrait_tag3_from_redis(device_id)
print(res_dic)
# print(res_dic)
for data_type in res_dic:
for tag in res_dic[data_type]:
if return_dict.get(tag):
......@@ -161,139 +161,14 @@ def get_device_num_from_es(word):
doc_type='doc',
timeout='10s',
size=0,
body={
"query": {
"bool": {
"should": [
{
"nested": {
"path": "first_demands",
"query": {
"bool": {
"must": [
{
"terms": {
"first_demands.name": [
word
]
}
}
]
}
}
}
},
{
"nested": {
"path": "second_demands",
"query": {
"bool": {
"must": [
{
"terms": {
"second_demands.name": [
word
]
}
}
]
}
}
}
},
{
"nested": {
"path": "first_solutions",
"query": {
"bool": {
"must": [
{
"terms": {
"first_solutions.name": [
word
]
}
}
]
}
}
}
},
{
"nested": {
"path": "second_solutions",
"query": {
"bool": {
"must": [
{
"terms": {
"second_solutions.name": [
word
]
}
}
]
}
}
}
},
{
"nested": {
"path": "first_positions",
"query": {
"bool": {
"must": [
{
"terms": {
"first_positions.name": [
word
]
}
}
]
}
}
}
},
{
"nested": {
"path": "second_positions",
"query": {
"bool": {
"must": [
{
"terms": {
"second_positions.name": [
word
]
}
}
]
}
}
}
},
{
"nested": {
"path": "projects",
"query": {
"bool": {
"must": [
{
"terms": {
"projects.name": [
word
]
}
}
]
}
}
}
body={"aggs": {
"NAME": {
"nested": {"path": "projects"}, "aggs": {
"NAME1": {
"terms": {"field": "projects.name", "size": 10000}
}
}
],
"minimum_should_match": 1
}
}
}
......@@ -315,6 +190,12 @@ def get_es_article_num(tag_dict):
}
for tag_type in tag_dict:
for tag_name in tag_dict[tag_type]:
if tag_type == "projects":
temp_name = "tags_v3"
elif tag_type == "first_positions":
temp_name = "positions"
else:
temp_name = tag_name
body = {
"query": {
"bool": {
......@@ -340,7 +221,7 @@ def get_es_article_num(tag_dict):
}
}
}
body["query"]["bool"]["must"].append({"term": {tag_type: tag_name}})
body["query"]["bool"]["must"].append({"term": {temp_name: tag_name}})
try:
results = es.search(
index='gm-dbmw-answer-read',
......@@ -365,7 +246,7 @@ def get_es_article_num(tag_dict):
}
}
}
body["query"]["bool"]["must"].append({"term": {tag_type: tag_name}})
body["query"]["bool"]["must"].append({"term": {temp_name: tag_name}})
# tractate
try:
results = es.search(
......@@ -409,7 +290,7 @@ def get_es_article_num(tag_dict):
}
},
}
body["query"]["bool"]["must"].append({"term": {tag_type: tag_name}})
body["query"]["bool"]["must"].append({"term": {temp_name: tag_name}})
###diary 日记
try:
results = es.search(
......
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