INNER CODE UNIT · Python

build_index

yifanfeng97/Hyper-Extract · hyperextract/cli/cli.py:1500

def build_index(
    ka_path: str = typer.Argument(..., help="Knowledge Abstract directory"),
    force: bool = typer.Option(False, "--force", "-f", help="Force rebuild"),
):
    """Build vector index for Knowledge Abstract."""
    logger.info("command=build-index ka_path=%s force=%s", ka_path, force)
    validate_config()

    path = validate_ka_with_data(ka_path)

    index_dir = path / "index"
    if index_dir.exists() and any(index_dir.iterdir()) and not force:
        console.print(
            "[yellow]Warning:[/yellow] Index already exists. Use --force to rebuild."
        )
        console.print(f"[dim]Index location: {index_dir}[/dim]")
        raise typer.Exit(0)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…