feat(search): infer --type and --column from indexes; default schema to public#90
Merged
Merged
Conversation
…to public Make --type and --column optional in hotdata search. When either is omitted, the CLI fetches the table indexes, filters to searchable types (bm25/vector), and resolves them automatically. Exits with a clear error when the result is ambiguous or no index exists. Accept connection.table as shorthand for connection.public.table in --table; schema defaults to public when omitted. Before: hotdata search query --type bm25 --table airbnb.public.listings --column description --limit 5 After: hotdata search query --table airbnb.listings --limit 5 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Comment on lines
+215
to
+230
| _ => { | ||
| let types: Vec<&str> = matches.iter().map(|i| i.index_type.as_str()).collect(); | ||
| let cols: Vec<String> = matches | ||
| .iter() | ||
| .flat_map(|i| i.columns.iter().cloned()) | ||
| .collect(); | ||
| eprintln!( | ||
| "{}", | ||
| format!( | ||
| "Multiple search indexes found (types: {}, columns: {}) — specify --type and --column.", | ||
| types.join(", "), | ||
| cols.join(", ") | ||
| ) | ||
| .red() | ||
| ); | ||
| std::process::exit(1); |
Contributor
There was a problem hiding this comment.
nit: (not blocking) When the user already passes one of --type/--column (so hint_type or hint_column is Some) and inference still finds multiple matches, the error tells them to "specify --type and --column". They've already specified one of them — only the missing hint would help. Consider tailoring the suggestion to whichever hint is still None (e.g. "specify --column" when hint_type was provided).
…r inference logic - Extract resolve_search_params as a pure function returning Result so the matching logic is testable without API mocking - Replace unwrap_or_default() on columns with ok_or_else() so an index with no columns produces a clear error instead of silent empty string - Add 9 unit tests covering single bm25/vector, hint narrowing, no indexes, multiple indexes, hint type mismatch, and empty columns Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes hotdata search less verbose by inferring flags from existing indexes.
Before: hotdata search "query" --type bm25 --table airbnb.public.listings --column description --limit 5
After: hotdata search "query" --table airbnb.listings --limit 5
Test plan
🤖 Generated with Claude Code