Finish implementing webhook delivery
This commit is contained in:
@@ -98,9 +98,11 @@ class StorageBackend(ABC):
|
||||
for tagname, tagvalue in item.items():
|
||||
add_bool.append({tagname: tagvalue})
|
||||
|
||||
valid = self.check_valid_query(query_params, custom_query)
|
||||
if isinstance(valid, dict):
|
||||
return valid
|
||||
bypass_check = kwargs.get("bypass_check", False)
|
||||
if not bypass_check:
|
||||
valid = self.check_valid_query(query_params, custom_query, **kwargs)
|
||||
if isinstance(valid, dict):
|
||||
return valid
|
||||
|
||||
return search_query
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ class ElasticsearchBackend(StorageBackend):
|
||||
)
|
||||
return query
|
||||
|
||||
def construct_query(self, query, size=None, blank=False):
|
||||
def construct_query(self, query, size=None, blank=False, **kwargs):
|
||||
"""
|
||||
Accept some query parameters and construct an Elasticsearch query.
|
||||
"""
|
||||
@@ -252,7 +252,10 @@ class ElasticsearchBackend(StorageBackend):
|
||||
if field not in ["source", "index", "tags", "query", "sentiment"]:
|
||||
for value in values:
|
||||
add_top.append({"match": {field: value}})
|
||||
search_query = self.parse_query(data, tags, None, False, add_bool)
|
||||
# Bypass the check for query and tags membership since we can search by msg, etc
|
||||
search_query = self.parse_query(
|
||||
data, tags, None, False, add_bool, bypass_check=True
|
||||
)
|
||||
self.add_bool(search_query, add_bool)
|
||||
self.add_top(search_query, add_top)
|
||||
if "sentiment" in data:
|
||||
@@ -503,4 +506,6 @@ class ElasticsearchBackend(StorageBackend):
|
||||
search_query["query"]["bool"]["must_not"] = [item]
|
||||
else:
|
||||
for item in add_top:
|
||||
if "query" not in search_query:
|
||||
search_query["query"] = {"bool": {"must": []}}
|
||||
search_query["query"]["bool"]["must"].append(item)
|
||||
|
||||
Reference in New Issue
Block a user