fix(search): add search.smart_case config option#3322
Open
daresTheDevil wants to merge 6 commits intoatuinsh:mainfrom
Open
fix(search): add search.smart_case config option#3322daresTheDevil wants to merge 6 commits intoatuinsh:mainfrom
daresTheDevil wants to merge 6 commits intoatuinsh:mainfrom
Conversation
When smart_case is true (the default), the existing behavior is preserved: all-lowercase queries match case-insensitively via LIKE, while queries containing uppercase characters match case-sensitively via GLOB. When smart_case is false, all queries match case-insensitively regardless of casing. This addresses the long-standing request for case-insensitive fuzzy search without needing to switch to skim or daemon-fuzzy mode. Closes atuinsh#625
The highlight functions had their own hardcoded smart-case logic via has_uppercase() checks, independent of the new search.smart_case config. This caused a mismatch where the SQL query would find results case-insensitively but highlights would fail to match. - Pass smart_case through to get_highlight_indices_fulltext - Set FzfV2 case sensitivity to Insensitive when smart_case is false - Lowercase search terms when matching against lowered command text to prevent mismatches (e.g., "Git" vs "git clone")
Contributor
Greptile SummaryAdds a
Important Files Changed
|
The daemon gRPC service and Nucleo index were hardcoding CaseMatching::Smart, silently ignoring search.smart_case = false. Now the setting propagates through SearchComponent → SearchGrpcService → SearchIndex::search and through the daemon highlight path.
SearchComponent::new() hardcoded smart_case=true. If the user had smart_case=false in config, searches before the history loader finished (potentially minutes on large histories) would use the wrong case mode. Now settings are read at the top of start() before spawning the loader. Also adds a dedicated test exercising smart_case=true vs false through the daemon search index (Nucleo CaseMatching::Smart vs Ignore).
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.
Adds a
search.smart_caseconfig option that controls whether fuzzy/fulltext search uses smart-case matching. Defaults totrue(current behavior preserved).When
true: all-lowercase queries match case-insensitively, uppercase queries match case-sensitively (via SQLite GLOB vs LIKE).When
false: all queries match case-insensitively regardless of casing.This addresses the TODO at
database.rs:513, which says "smart case mode could be made configurable like in fzf".What changed
settings.rs: addedsmart_case: boolto theSearchconfig struct (defaulttrue)database.rs: the GLOB-vs-LIKE decision now checkssmart_case && token.has_uppercase()instead of justtoken.has_uppercase()engines/db.rs: highlight functions respectsmart_casetoo, so highlights stay consistent with query results. FzfV2 case sensitivity and fulltext term matching both updated.engines/daemon.rs: daemon regex fallback path also threadssmart_casethrough to highlightsconfig.toml: documented under[search]smart_case=trueandsmart_case=falsebehaviorKnown limitations
skimanddaemon-fuzzymodes have their own case handling and don't read this setting yet. They could be wired up in a follow-upCredits
This has been requested since 2022. Thanks to everyone in the thread:
Closes #625
Checks