-
Notifications
You must be signed in to change notification settings - Fork 30
[BUG] search.rs Uses partial_cmp with unwrap_or for Score Sorting #183
Copy link
Copy link
Closed
Labels
Description
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
Reactions are currently unavailable