WIP: add '--search-type' option to CLI 'search'
This commit is contained in:
parent
f588e1150b
commit
b2ffc50168
2 changed files with 15 additions and 2 deletions
|
|
@ -361,6 +361,7 @@ class HaikuRAGApp: # pragma: no cover
|
||||||
query: str | None = None,
|
query: str | None = None,
|
||||||
limit: int | None = None,
|
limit: int | None = None,
|
||||||
filter: str | None = None,
|
filter: str | None = None,
|
||||||
|
search_type: str = "hybrid",
|
||||||
image: Path | None = None,
|
image: Path | None = None,
|
||||||
):
|
):
|
||||||
if query is None and image is None:
|
if query is None and image is None:
|
||||||
|
|
@ -385,7 +386,9 @@ class HaikuRAGApp: # pragma: no cover
|
||||||
read_only=self.read_only,
|
read_only=self.read_only,
|
||||||
before=self.before,
|
before=self.before,
|
||||||
) as self.client:
|
) 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:
|
if not results:
|
||||||
self.console.print("[yellow]No results found.[/yellow]")
|
self.console.print("[yellow]No results found.[/yellow]")
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -314,6 +314,12 @@ def search( # pragma: no cover
|
||||||
"-f",
|
"-f",
|
||||||
help="SQL WHERE clause to filter documents (e.g., \"uri LIKE '%arxiv%'\")",
|
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(
|
image: Path | None = typer.Option(
|
||||||
None,
|
None,
|
||||||
"--image",
|
"--image",
|
||||||
|
|
@ -326,7 +332,11 @@ def search( # pragma: no cover
|
||||||
),
|
),
|
||||||
):
|
):
|
||||||
app = create_app(db)
|
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")
|
@_cli.command("visualize", help="Show visual grounding for a chunk")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue