You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix: Add missing chrono-node and fuse.js dependencies to bundle script
The Smart Search feature requires chrono-node for date parsing and fuse.js
for fuzzy matching, but these were not included in the extension bundle.
This caused "Cannot find module 'chrono-node'" error when using the
Search Notes command.
Updated bundle-deps.js to include:
- chrono-node: Required by QueryAnalyzer for natural language date parsing
- fuse.js: Required by KeywordSearch for fuzzy matching
Fixes issue where extension fails to load when packaged with --no-dependencies.
* Fix: Improve Smart Search error handling and add automatic fallback
The Smart Search feature was failing silently after rate limiting or LLM
errors, showing "No results found" even when results should exist.
Changes:
1. SemanticSearchEngine:
- Track consecutive errors during semantic search
- Throw descriptive error after 3 consecutive failures
- Clearly communicate rate limiting or API issues to user
2. SearchOrchestrator:
- Add try-catch in semanticOnlySearch with fallback to keyword search
- Add try-catch in hybridSearch with fallback to keyword results
- Show warning messages when falling back to keyword search
- Ensure users always get results even when AI is unavailable
This fixes the issue where users would see "No results found" after
multiple searches when the LLM API was rate-limited. Now they'll get:
- A clear warning message explaining the issue
- Automatic fallback to keyword-based search
- Actual search results instead of empty results
Resolves issue where search appeared broken after 3-4 consecutive searches.
* Debug: Add detailed logging to diagnose search issues
Added console.log statements to track:
- Query input and analysis
- Number of files found and filtered
- Search results at each stage
- Final result count after filtering
This will help diagnose why search returns no results immediately.
* Debug: Add logging to KeywordSearch and advancedSearch
Added debug logging to trace the keyword search flow:
- KeywordSearch: Log input query, filters, options, and legacy results
- advancedSearch: Log notes path, query, hasTextSearch flag, and result count
This will help identify where the search is failing.
* Debug: Add file-level logging to trace search pattern matching
Added counters and detailed logging:
- Track how many files are processed
- Track how many files have matches
- Log first 2 files: content length, search pattern, matches, and first 200 chars
- This will help identify if search pattern is correct and why no matches found
* Fix: Split multi-word search queries into individual keywords
The keyword search was treating multi-word queries like "authentication issues"
as exact phrases, requiring both words to appear together. This resulted in 0
results even when files contained the individual words.
Changes:
- Split queries on whitespace into individual keywords
- Create OR pattern: "authentication issues" → /(authentication|issues)/gi
- Files now match if they contain ANY of the keywords
- Single-word queries unchanged
- Regex queries unchanged (user-provided patterns used as-is)
This matches user expectations for search: searching "authentication issues"
will now find files containing either "authentication" OR "issues".
Example:
- Before: Required exact phrase "authentication issues"
- After: Matches "authentication error" OR "login issues" OR both
* Debug: Add score distribution logging to identify filtering issue
The search finds 18 results but final filtering returns 0. Added logging to show:
- Score distribution for first 5 results
- Min relevance score threshold
This will identify if scores are below the threshold.
* Fix: Update scoring algorithm to work with split keywords
The scoring algorithm was still using the full query phrase "authentication issues"
to calculate scores, even though the search pattern was split into individual
keywords. This caused all scores to be below 0.5, filtering out all results.
Changes to calculateScore():
1. Split multi-word queries into individual keywords for scoring
2. Increased match count weight: 0.3 → 0.4 (primary relevance signal)
3. Title matching: Score based on proportion of keywords found in filename
4. Preview relevance: Count all keyword occurrences, max increased 0.2 → 0.3
Example scoring for "authentication issues" query on file with "authentication":
- Before: ~0.3 (below 0.5 threshold) → filtered out
- After: ~0.6+ (above 0.5 threshold) → included in results
This fixes the issue where search found 18 results but filtered all to 0.
* Clean: Remove debug logging from search functionality
Removed all console.log('[NOTED DEBUG...]') statements added during debugging.
Kept important error logging (console.error, console.warn) for production use.
Files cleaned:
- src/search/SearchOrchestrator.ts
- src/search/KeywordSearch.ts
- src/services/searchService.ts
Search functionality is now working correctly with clean console output.
* Test: Add comprehensive tests for Smart Search fixes
Added three test files to prevent regressions of the bugs we fixed:
1. **keywordSearch.test.ts** - Tests for KeywordSearch class
- Verifies multi-word queries are split and searched with OR logic
- Tests scoring algorithm works with split keywords
- Ensures scores exceed 0.5 threshold
- Tests proportional scoring when multiple keywords match
- Edge cases: empty queries, whitespace, multiple spaces
2. **bundleDeps.test.ts** - Dependency bundling verification
- Verifies chrono-node and fuse.js are in bundle-deps.js
- Checks package.json declares all required dependencies
- Tests dependencies can be required at runtime
- Prevents "Cannot find module" errors in packaged extension
3. **advancedSearchKeywordSplit.test.ts** - Keyword splitting logic
- Tests regex pattern generation from multi-word queries
- Verifies "authentication issues" → /(authentication|issues)/gi
- Tests OR logic: matches files with either keyword
- Tests special character escaping in queries
- Documents scoring implications and thresholds
These tests would have caught all three bugs we fixed:
- Missing dependencies (chrono-node, fuse.js)
- Multi-word queries treated as exact phrases
- Scoring algorithm not working with split keywords
All 439 tests passing.
* Clean: Remove debug logging from advanced search function
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Jason Rueckert <jruecke@costco.com>
0 commit comments