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,
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in a new issue