ModernUO/Projects/UOContent.Tests/Tests/Engines
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
..
AdvancedSearch fix: Advanced Search results came back in a different order every search (#2626) 2026-09-10 19:14:09 -07:00
Chat feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
Events chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Factions fix(opl): refuse property list invalidation raised from inside GetProperties (#2555) 2026-07-28 21:29:03 -07:00
Help feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
ML Quests feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
Party feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
Pathing perf(pathing): pool the StepCache strata buffer, then clean up the pathing engine around it (#2523) 2026-07-12 20:02:29 -07:00
Plants fix: OPL revision hash collided on reordered and repeated properties (#2615) 2026-09-06 21:32:12 -07:00
Spawners refactor(spawners): replace DynamicJson with typed SpawnerDto records (#2505) 2026-06-25 23:24:45 -07:00
Veteran Rewards/Character Statue Maker feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00