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): ...@@ -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,18 +569,12 @@ class TopicUtils(object): ...@@ -568,18 +569,12 @@ 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(k, list): if isinstance(v, list):
f.append({ f.append({
"terms": {k: v}, "terms": {k: v},
}) })
...@@ -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}})
...@@ -654,7 +649,7 @@ class TopicUtils(object): ...@@ -654,7 +649,7 @@ class TopicUtils(object):
@classmethod @classmethod
def list_topic_ids(cls, filters, nfilters, sorts_by, offset=0, size=10, index_name="topic", filter_online=True): 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 = { q = {
"query": { "query": {
"bool": { "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