Commit 3985573b authored by zhanglu's avatar zhanglu

Merge branch 'feature/sun_tag2es' into 'feature/sun_topic2es'

Feature/sun tag2es

See merge request !198
parents 394e5924 ce552cd5
......@@ -556,6 +556,7 @@ class TopicUtils(object):
f = [
{"term": {"is_deleted": False}},
]
_range = {}
if not filters:
return f
......@@ -568,18 +569,12 @@ class TopicUtils(object):
if k == "create_time_gte":
op = "gte"
_range.update({op:v})
elif k == "create_time_lte":
op = "lte"
f.append({
"range": {
"create_time_val": {
op: v,
}
}
})
_range.update({op: v})
else:
if isinstance(k, list):
if isinstance(v, list):
f.append({
"terms": {k: v},
})
......@@ -587,7 +582,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}})
......@@ -654,7 +649,7 @@ class TopicUtils(object):
@classmethod
def list_topic_ids(cls, filters, nfilters, sorts_by, offset=0, size=10, index_name="topic", filter_online=True):
must = cls.process_filters(filters, filter_online=True)
must = cls.process_filters(filters, filter_online=filter_online)
q = {
"query": {
"bool": {
......
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