Commit ce552cd5 authored by 许俊鹏's avatar 许俊鹏

更改range范围查询

parent 387dc6b3
...@@ -556,6 +556,7 @@ class TopicUtils(object): ...@@ -556,6 +556,7 @@ class TopicUtils(object):
f = [ f = [
{"term": {"is_deleted": False}}, {"term": {"is_deleted": False}},
] ]
_range = {}
if not filters: if not filters:
return f return f
...@@ -568,16 +569,10 @@ class TopicUtils(object): ...@@ -568,16 +569,10 @@ class TopicUtils(object):
if k == "create_time_gte": if k == "create_time_gte":
op = "gte" op = "gte"
_range.update({op:v})
elif k == "create_time_lte": elif k == "create_time_lte":
op = "lte" op = "lte"
_range.update({op: v})
f.append({
"range": {
"create_time_val": {
op: v,
}
}
})
else: else:
if isinstance(v, list): if isinstance(v, list):
f.append({ f.append({
...@@ -587,7 +582,7 @@ class TopicUtils(object): ...@@ -587,7 +582,7 @@ class TopicUtils(object):
f.append({ f.append({
"term": {k: v}, "term": {k: v},
}) })
f.append({"range": {"create_time_val": _range}})
if filter_online: if filter_online:
f.append({"term": {"is_online": True}}) f.append({"term": {"is_online": True}})
......
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