Default external off and filter channels/backlink queries
Some checks failed
docker-build / build (push) Has been cancelled

This commit is contained in:
2025-11-18 23:42:49 -05:00
parent 4c20329f36
commit c6b46edacc
3 changed files with 23 additions and 9 deletions

View File

@@ -746,6 +746,8 @@ def create_app(config: AppConfig = CONFIG) -> Flask:
@app.route("/api/channels")
def channels():
include_external = request.args.get("external", default="0", type=str)
include_external = include_external.lower() not in {"0", "false", "no"}
base_channels_body = {
"size": 0,
"aggs": {
@@ -762,6 +764,10 @@ def create_app(config: AppConfig = CONFIG) -> Flask:
}
},
}
if not include_external:
base_channels_body["query"] = {
"bool": {"must_not": [{"term": {"external_reference": True}}]}
}
def run_channels_request(field_name: str):
body = json.loads(json.dumps(base_channels_body)) # deep copy
@@ -920,7 +926,7 @@ def create_app(config: AppConfig = CONFIG) -> Flask:
use_fuzzy = parse_flag("fuzzy", True)
use_phrase = parse_flag("phrase", True)
use_query_string = parse_flag("query_string", False)
include_external = parse_flag("external", True)
include_external = parse_flag("external", False)
if use_query_string:
use_exact = use_fuzzy = use_phrase = False
@@ -1075,7 +1081,7 @@ def create_app(config: AppConfig = CONFIG) -> Flask:
use_exact = parse_flag("exact", True)
use_fuzzy = parse_flag("fuzzy", True)
use_phrase = parse_flag("phrase", True)
include_external = parse_flag("external", True)
include_external = parse_flag("external", False)
if use_query_string:
use_exact = use_fuzzy = use_phrase = False