fix: default 'search_type' to 'None' in 'client.search.search'

Apply 'hybrid' default only for text queries.
This commit is contained in:
Tres Seaver 2026-05-18 06:52:03 -04:00
parent 5079205d3d
commit b331dd0b76
No known key found for this signature in database
GPG key ID: F2A968348913D1D8

View file

@ -15,7 +15,7 @@ async def search(
client: "HaikuRAG",
query: "str | bytes | PILImage.Image",
limit: int | None = None,
search_type: SearchType = "hybrid",
search_type: SearchType | None = None,
filter: str | None = None,
include_images: bool = True,
) -> list[SearchResult]:
@ -26,7 +26,8 @@ async def search(
query: Text (``str``) or image (``bytes`` / ``PIL.Image.Image``).
Image queries require a multimodal embedder and run vector-only.
limit: Maximum number of results to return. Defaults to config.search.limit.
search_type: "vector", "fts", or "hybrid" (default). Text queries only.
search_type: "vector", "fts", or "hybrid".
Applicable onlly for text queries, where the default is "hybrid".
filter: Optional SQL WHERE clause to filter documents before searching chunks.
include_images: When True, populate ``SearchResult.image_data`` with
base64 picture bytes for picture-labeled chunks.
@ -38,6 +39,10 @@ async def search(
limit = client._config.search.limit
if isinstance(query, str):
if search_type is None:
search_type = "hybrid"
reranker = get_reranker(config=client._config)
if reranker is None: