def METHOD_NAME(d: DocInfo, args: SearchArgumentsCLI) -> int:
    """Same as :func:`search`, but prints the matches according to the provided format."""
    found = 0
    for result in search(d, args, use_exported=args.exported):
        found = result.num_pars_found
        if args.docsonly:
            print(d.url)
            break
        header = get_url_for_match(args, d, result.par)
        if args.format:
            print(result.format_match(args))
            continue
        print(
            f"""