Project
vgrep
Description
In search.rs line 82-85, the sorting uses partial_cmp with unwrap_or(std::cmp::Ordering::Equal). If scores contain NaN values (which can propagate from the embedding engine), this leads to non-deterministic sorting behavior since NaN comparisons return None.
Error Message
Debug Logs
System Information
OS: Any
Rust Version: 1.75+
Screenshots
No response
Steps to Reproduce
- Cause the embedding engine to produce NaN values (e.g., through numerical overflow)
- Perform a search
- Observe the ordering of results across multiple runs
Expected Behavior
Results should be consistently sorted, and NaN scores should be handled explicitly (e.g., placed at the end)
Actual Behavior
Results with NaN scores may appear in random positions due to unstable sorting behavior
Additional Context
No response
Project
vgrep
Description
In
search.rsline 82-85, the sorting usespartial_cmpwithunwrap_or(std::cmp::Ordering::Equal). If scores contain NaN values (which can propagate from the embedding engine), this leads to non-deterministic sorting behavior since NaN comparisons return None.Error Message
Debug Logs
System Information
Screenshots
No response
Steps to Reproduce
Expected Behavior
Results should be consistently sorted, and NaN scores should be handled explicitly (e.g., placed at the end)
Actual Behavior
Results with NaN scores may appear in random positions due to unstable sorting behavior
Additional Context
No response