ModernUO/Projects
Kamron Batman f7caff8ad3
fix: Advanced Search results came back in a different order every search (#2626)
## Summary

Advanced Search results came back in a different order every search, whether or not a sort was chosen. Follow-up to #2625, where it was noticed while testing the property test.

## Why

Results arrive from the search workers in whatever order they finished. Each sort the gump offers compares a single key and `Array.Sort` is not stable, so equal keys, which is most rows under type or map, landed in a different order every run; with no sort chosen the list was arrival order outright. The range sort also answered 0 for any two results off the viewer's map, so those shuffled as well.

## What changed

- The five comparers share one base class whose `Compare` applies the chosen key and then a fixed tie-break, serial ascending regardless of direction. The direction is about the key; a fixed order among equal keys is what keeps two searches identical.
- The collected result list is put in serial order before the gump sees it, so an unsorted search is deterministic too. That sort runs on the thread-pool work item that already assembles the list and reads only the result records.
- No change to which key each sort uses or to what ascending and descending mean.

## Test plan

- [x] New `AdvancedSearchResultOrderTests`: six equal-keyed results offered in two arrival orders to every comparer in both directions, asserting the same sequence and serial order; the range comparer on off-map results; reverse flips the key but not the tie-break.
- [x] `UOContent.Tests`: 873 passed, 0 failed
- [x] `Server.Tests`: 869 passed, 0 failed
- [ ] In game: run the same search twice with each sort and with none; the lists match.
2026-09-10 19:14:09 -07:00
..
Application fix: Bumps dependencies. (#2531) 2026-07-14 15:17:55 -07:00
BuildTool feat: Bumps dependencies. Introduces Serialization Generator v3 (#2584) 2026-08-22 15:48:53 -07:00
Logger fix: Bumps dependencies. (#2531) 2026-07-14 15:17:55 -07:00
Server fix: OPL revision hash collided on reordered and repeated properties (#2615) 2026-09-06 21:32:12 -07:00
Server.Tests fix: OPL revision hash collided on reordered and repeated properties (#2615) 2026-09-06 21:32:12 -07:00
UOContent fix: Advanced Search results came back in a different order every search (#2626) 2026-09-10 19:14:09 -07:00
UOContent.Tests fix: Advanced Search results came back in a different order every search (#2626) 2026-09-10 19:14:09 -07:00