INNER CODE UNIT · Python
_print_search_hits
yifanfeng97/Hyper-Extract · hyperextract/cli/cli.py:993
def _print_search_hits(hits) -> None:
"""Print `he search` hits from :class:`SearchHits`."""
if hits.count == 0:
console.print("[yellow]No results found.[/yellow]")
return
console.print(f"[bold green]Found {hits.count} result(s):[/bold green]")
console.print()
if hits.kind == "mapping":
preferred = [key for key in ("themes", "entities") if key in hits.payload]
other = [key for key in hits.payload if key not in preferred]
for key in preferred + other:
title = key[:1].upper() + key[1:] if key else key
_print_search_section(title, hits.payload[key])
return
if hits.kind == "graph":