Add clickable reference badges and improve UI layout
- Add clickable badges for backlinks and references that trigger query string searches - Improve toggle checkbox layout with better styling - Add description block styling with scrollable container - Update results styling with bordered cards and shadows - Add favicon support across pages - Enhance .env loading with logging for debugging 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -748,7 +748,9 @@ def create_app(config: AppConfig = CONFIG) -> Flask:
|
||||
"secondary": bool(highlight_map.get("transcript_secondary_full")),
|
||||
},
|
||||
"internal_references_count": source.get("internal_references_count", 0),
|
||||
"internal_references": source.get("internal_references", []),
|
||||
"referenced_by_count": source.get("referenced_by_count", 0),
|
||||
"referenced_by": source.get("referenced_by", []),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -802,48 +804,50 @@ def create_app(config: AppConfig = CONFIG) -> Flask:
|
||||
start = request.args.get("start", type=str)
|
||||
end = request.args.get("end", type=str)
|
||||
|
||||
filters: List[Dict] = []
|
||||
channel_filter = build_channel_filter(channels)
|
||||
if channel_filter:
|
||||
filters.append(channel_filter)
|
||||
year_filter = build_year_filter(year)
|
||||
if year_filter:
|
||||
filters.append(year_filter)
|
||||
def parse_flag(name: str, default: bool = True) -> bool:
|
||||
value = request.args.get(name)
|
||||
if value is None:
|
||||
return default
|
||||
lowered = value.lower()
|
||||
return lowered not in {"0", "false", "no"}
|
||||
|
||||
use_exact = parse_flag("exact", True)
|
||||
use_fuzzy = parse_flag("fuzzy", True)
|
||||
use_phrase = parse_flag("phrase", True)
|
||||
if use_query_string:
|
||||
use_exact = use_fuzzy = use_phrase = False
|
||||
|
||||
search_payload = build_query_payload(
|
||||
term,
|
||||
channels=channels,
|
||||
year=year,
|
||||
sort="relevant",
|
||||
use_exact=use_exact,
|
||||
use_fuzzy=use_fuzzy,
|
||||
use_phrase=use_phrase,
|
||||
use_query_string=use_query_string,
|
||||
)
|
||||
query = search_payload.get("query", {"match_all": {}})
|
||||
|
||||
if start or end:
|
||||
range_filter: Dict[str, Dict[str, Dict[str, str]]] = {"range": {"date": {}}}
|
||||
if start:
|
||||
range_filter["range"]["date"]["gte"] = start
|
||||
if end:
|
||||
range_filter["range"]["date"]["lte"] = end
|
||||
filters.append(range_filter)
|
||||
|
||||
base_fields = ["title^3", "description^2", "transcript_full", "transcript_secondary_full"]
|
||||
if use_query_string:
|
||||
qs_query = term or "*"
|
||||
must_clause: List[Dict[str, Any]] = [
|
||||
{
|
||||
"query_string": {
|
||||
"query": qs_query,
|
||||
"default_operator": "AND",
|
||||
"fields": base_fields,
|
||||
}
|
||||
}
|
||||
]
|
||||
else:
|
||||
must_clause = [
|
||||
{
|
||||
"multi_match": {
|
||||
"query": term,
|
||||
"fields": base_fields,
|
||||
"type": "best_fields",
|
||||
"operator": "and",
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
query: Dict[str, Any] = {"bool": {"must": must_clause}}
|
||||
if filters:
|
||||
query["bool"]["filter"] = filters
|
||||
if "bool" in query:
|
||||
bool_clause = query.setdefault("bool", {})
|
||||
existing_filter = bool_clause.get("filter")
|
||||
if existing_filter is None:
|
||||
bool_clause["filter"] = [range_filter]
|
||||
elif isinstance(existing_filter, list):
|
||||
bool_clause["filter"].append(range_filter)
|
||||
else:
|
||||
bool_clause["filter"] = [existing_filter, range_filter]
|
||||
elif query.get("match_all") is not None:
|
||||
query = {"bool": {"filter": [range_filter]}}
|
||||
else:
|
||||
query = {"bool": {"must": [query], "filter": [range_filter]}}
|
||||
|
||||
histogram: Dict[str, Any] = {
|
||||
"field": "date",
|
||||
|
||||
Reference in New Issue
Block a user