Commit 49f024c7 authored by zhanglu's avatar zhanglu

添加es查询条件

parent 3985573b
......@@ -556,7 +556,7 @@ class TopicUtils(object):
f = [
{"term": {"is_deleted": False}},
]
_range = {}
if not filters:
return f
......@@ -569,10 +569,31 @@ class TopicUtils(object):
if k == "create_time_gte":
op = "gte"
_range.update({op:v})
elif k == "create_time_lte":
op = "lte"
_range.update({op: v})
f.append({
"range": {
"create_time_val": {
op: v,
}
}
})
elif k in ["id_gte", "id_lte"]:
if k == "id_gte":
op = "gte"
elif k == "id_lte":
op = "lte"
f.append({
"range": {
"id": {
op: v,
}
}
})
else:
if isinstance(v, list):
f.append({
......@@ -582,7 +603,7 @@ class TopicUtils(object):
f.append({
"term": {k: v},
})
f.append({"range": {"create_time_val": _range}})
if filter_online:
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