Commit 443cf875 authored by 段英荣's avatar 段英荣

Merge branch 'hera_search' into 'master'

hera

See merge request !330
parents 42514adb e2c35817
...@@ -912,6 +912,7 @@ class TopicUtils(object): ...@@ -912,6 +912,7 @@ class TopicUtils(object):
def business_topic_ids(cls, filters, nfilters, sorts_by, offset=0, size=10, index_name="topic", filter_online=True): def business_topic_ids(cls, filters, nfilters, sorts_by, offset=0, size=10, index_name="topic", filter_online=True):
must = cls.business_filters(filters, filter_online=filter_online) must = cls.business_filters(filters, filter_online=filter_online)
logging.info("get must:%s" % must)
q = { q = {
"query": { "query": {
"bool": { "bool": {
...@@ -919,6 +920,7 @@ class TopicUtils(object): ...@@ -919,6 +920,7 @@ class TopicUtils(object):
"must_not": cls.process_nfilters(nfilters), "must_not": cls.process_nfilters(nfilters),
} }
} }
} }
if sorts_by: if sorts_by:
...@@ -965,7 +967,12 @@ class TopicUtils(object): ...@@ -965,7 +967,12 @@ class TopicUtils(object):
if k == "content": if k == "content":
f.append({ f.append({
"match": {k: v} "multi_match": {
"fields": ["content"],
"type": "cross_fields",
"operator": "and",
"query": v
}
}) })
elif k == "virtual_content_level": elif k == "virtual_content_level":
...@@ -973,6 +980,21 @@ class TopicUtils(object): ...@@ -973,6 +980,21 @@ class TopicUtils(object):
"match": {k: v} "match": {k: v}
}) })
elif k in ["create_time_gte", "create_time_lte"]:
if k == "create_time_gte":
op = "gte"
elif k == "create_time_lte":
op = "lte"
f.append({
"range": {
"create_time_val": {
op: v,
}
}
})
else: else:
if isinstance(v, list): if isinstance(v, list):
......
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