Project
vgrep
Description
The cosine_similarity() function in src/core/db.rs lines 286-289 silently returns 0.0 when comparing embeddings of different dimensions. This can happen if the embedding model is changed after indexing. All search results will show 0% similarity with no indication of the underlying problem.
Error Message
No error message - all search results silently show 0% similarity.
Debug Logs
System Information
- Bounty Version: 0.1.0
- OS: Ubuntu 24.04 LTS
- Rust: 1.75+
Screenshots
No response
Steps to Reproduce
- Index a codebase with the default embedding model (768 dimensions)
- Switch to a different embedding model with different dimensions
- Perform a search
- Observe all results show 0% or very low similarity
Expected Behavior
When embedding dimensions don't match:
- Log a warning about dimension mismatch
- Return an error or special value indicating incompatibility
- Suggest running
vgrep index --force to reindex with current model
- Show clear error message to user
Actual Behavior
- Dimension mismatch is silently ignored
- All comparisons return 0.0 similarity
- Search results appear with 0% match scores
- User has no indication of the problem or how to fix it
Additional Context
This bug is particularly insidious because:
- The user sees search results (just with low scores)
- There's no error message
- The fix (reindexing) is not suggested
- Users may think the tool just doesn't work well
Common scenarios that trigger this:
- Upgrading vgrep to a version with a different default model
- Manually changing the embedding model in config
- Corrupted model download resulting in wrong model being used
Project
vgrep
Description
The
cosine_similarity()function insrc/core/db.rslines 286-289 silently returns 0.0 when comparing embeddings of different dimensions. This can happen if the embedding model is changed after indexing. All search results will show 0% similarity with no indication of the underlying problem.Error Message
Debug Logs
System Information
Screenshots
No response
Steps to Reproduce
Expected Behavior
When embedding dimensions don't match:
vgrep index --forceto reindex with current modelActual Behavior
Additional Context
This bug is particularly insidious because:
Common scenarios that trigger this: