fix: global search case-insensitive + keyboard layout swap
Unified search normalization across InternalLinkPicker and GlobalSearch: 1. GlobalSearch.svelte: multi-variant search (same as InternalLinkPicker) - expandKeyboardVariants() for RU/EN layout swap - Parallel Search queries with dedup by type+nodeId+targetId+title - 180ms debounce preserved 2. Backend: fix LOWER() in SQL for links/actions - Replace LOWER(column) LIKE with lowercased columns (title_lower, url_lower, etc.) - Migration 020: add lowercased columns + indexes for links and actions - BackfillLinksLower() + BackfillActionsLower() in storage.go - Update INSERT in bindings_links.go and action.go to populate lowercased columns 3. FTS5 search: Unicode case-insensitive - Index lowercased title/content/tags in search_index - sanitizeFTS() now lowercases query before MATCH - RebuildFTS() called after migrations 4. Case-insensitive search for nodes (already done in previous commit, verified): - title_lower column with Go strings.ToLower - Search() queries title_lower with lowercased query All test suites PASS, full build OK.
This commit is contained in:
@@ -32,7 +32,7 @@ func (s *Service) Index(nodeID, title, content, path, tags, docType string) erro
|
||||
_, err := s.db.Exec(
|
||||
`INSERT INTO search_index (node_id,title,content,path,tags,type)
|
||||
VALUES (?,?,?,?,?,?)`,
|
||||
nodeID, title, content, path, tags, docType,
|
||||
nodeID, strings.ToLower(title), strings.ToLower(content), path, strings.ToLower(tags), docType,
|
||||
)
|
||||
return err
|
||||
}
|
||||
@@ -92,7 +92,9 @@ func (s *Service) Search(query string) ([]Result, error) {
|
||||
|
||||
func sanitizeFTS(q string) string {
|
||||
// Wrap in double quotes for phrase search, escape inner quotes.
|
||||
// Also lowercase the query since we index lowercased content.
|
||||
q = strings.TrimSpace(q)
|
||||
q = strings.ToLower(q)
|
||||
q = strings.ReplaceAll(q, `"`, `""`)
|
||||
return `"` + q + `"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user