WIP: add '--search-type' option to CLI 'search'

This commit is contained in:
Tres Seaver 2026-05-17 08:55:43 -04:00
parent f588e1150b
commit b2ffc50168
No known key found for this signature in database
GPG key ID: F2A968348913D1D8
2 changed files with 15 additions and 2 deletions

View file

@ -361,6 +361,7 @@ class HaikuRAGApp: # pragma: no cover
query: str | None = None,
limit: int | None = None,
filter: str | None = None,
search_type: str = "hybrid",
image: Path | None = None,
):
if query is None and image is None:
@ -385,7 +386,9 @@ class HaikuRAGApp: # pragma: no cover
read_only=self.read_only,
before=self.before,
) as self.client:
results = await self.client.search(search_input, limit=limit, filter=filter)
results = await self.client.search(
search_input, limit=limit, filter=filter, search_type=search_type,
)
if not results:
self.console.print("[yellow]No results found.[/yellow]")
return

View file

@ -314,6 +314,12 @@ def search( # pragma: no cover
"-f",
help="SQL WHERE clause to filter documents (e.g., \"uri LIKE '%arxiv%'\")",
),
search_type: str | None = typer.Option(
None,
"--search-type",
"-s",
help="Type of search: one of 'hybrid' (default) / 'fts' / 'vector' ",
),
image: Path | None = typer.Option(
None,
"--image",
@ -326,7 +332,11 @@ def search( # pragma: no cover
),
):
app = create_app(db)
asyncio.run(app.search(query=query, limit=limit, filter=filter, image=image))
asyncio.run(
app.search(
query=query, limit=limit, filter=filter, search_type=search_type, image=image,
)
)
@_cli.command("visualize", help="Show visual grounding for a chunk")