Commit 00689d75 authored by lixiaofang's avatar lixiaofang

add

parent 7d8cbd2f
...@@ -744,28 +744,12 @@ class TopicUtils(object): ...@@ -744,28 +744,12 @@ class TopicUtils(object):
must = cls.process_filters(filters, filter_online=filter_online) must = cls.process_filters(filters, filter_online=filter_online)
query = '' query = ''
for k, v in filters.items(): for k, v in filters.items():
if k == "content": if k == "content" or k == "id":
query = filters["content"] query = filters["content"]
q = {} q = {}
# q = {
# "query": {
# "bool": {
# "must": must,
# "must_not": cls.process_nfilters(nfilters),
# },
# "multi_match": {
# "fields": ["title", "content"],
# "type": "cross_fields",
# "operator": "or",
# "query": query
#
# }
# }
# }
q["query"] = { q["query"] = {
"function_score": { "function_score": {
"functions":[{ "functions": [{
"filter": { "filter": {
"bool": { "bool": {
"must": must, "must": must,
...@@ -776,7 +760,7 @@ class TopicUtils(object): ...@@ -776,7 +760,7 @@ class TopicUtils(object):
}], }],
"query": { "query": {
"multi_match": { "multi_match": {
"fields": ["content","id","content_level","user_id","pictorial_id"], # "fields": ["content", "id", "content_level", "user_id", "pictorial_id"],
"type": "cross_fields", "type": "cross_fields",
"operator": "or", "operator": "or",
"query": query "query": query
...@@ -809,7 +793,6 @@ class TopicUtils(object): ...@@ -809,7 +793,6 @@ class TopicUtils(object):
"total_count": 0 "total_count": 0
} }
@classmethod @classmethod
def business_topic_id(cls, filters, nfilters, sorts_by, offset=0, size=10, index_name="topic", filter_online=True): def business_topic_id(cls, filters, nfilters, sorts_by, offset=0, size=10, index_name="topic", filter_online=True):
...@@ -820,15 +803,14 @@ class TopicUtils(object): ...@@ -820,15 +803,14 @@ class TopicUtils(object):
if k == "content": if k == "content":
query = filters["content"] query = filters["content"]
match={ match = {
"match":{ "match": {
"content":{ "content": {
query query
} }
} }
} }
q = { q = {
"query": { "query": {
"bool": { "bool": {
...@@ -858,4 +840,4 @@ class TopicUtils(object): ...@@ -858,4 +840,4 @@ class TopicUtils(object):
return { return {
"hits": [], "hits": [],
"total_count": 0 "total_count": 0
} }
\ No newline at end of file
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