Skip to content

Commit

Permalink
feat: ❇️ enable post_filter for POST query
Browse files Browse the repository at this point in the history
Previously only enabled in GET query, see issue #208
  • Loading branch information
newgene committed Sep 12, 2023
1 parent e6916ff commit 83748c2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions biothings/web/settings/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,26 @@
"POST": {"id": {"type": list, "max": 1000, "required": True, "alias": "ids"}},
}
QUERY_KWARGS = {
"*": COMMON_KWARGS.copy(),
"*": {
**COMMON_KWARGS.copy(),
**{
"from": {"type": int, "max": 10000, "alias": "skip"},
"sort": {"type": list, "max": 10},
"post_filter": {"type": str, "default": None},
},
}, # for py3.9+, we can just use `|` operator like `COMMON_KWARGS.copy() | {...}`
"GET": {
"q": {"type": str, "default": None},
"aggs": {"type": list, "max": 1000, "alias": "facets"},
"post_filter": {"type": str, "default": None},
"facet_size": {"type": int, "default": 10, "max": 1000},
"from": {"type": int, "max": 10000, "alias": "skip"},
"userquery": {"type": str, "alias": ["userfilter"]},
"sort": {"type": list, "max": 10},
"explain": {"type": bool},
"fetch_all": {"type": bool},
"scroll_id": {"type": str},
},
"POST": {
"q": {"type": list, "required": True},
"scopes": {"type": list, "default": ["_id"], "max": 1000},
"from": {"type": int, "max": 10000, "alias": "skip"},
"sort": {"type": list, "max": 10},
"with_total": {"type": bool},
"analyzer": {"type": str}, # any of built-in analyzer (overrides default index-time analyzer)
# Ref: https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-analyzers.html
Expand Down

0 comments on commit 83748c2

Please sign in to comment.