PoB Trader: add self adjusting weighted search to prevent result clipping #5510
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current PoE trade API returns at most 10k results per search which are not guaranteed to include the highest-scored items.
There were attempts to improve the situation by calculating a better min weight limit but that doesn't guarantee a solution.
This PR proposes an iterative approach to solve the issue. The new method keeps repeating the search as long as the results come out capped. Each time, the weight of the highest-rated item of the previous search is used as the new min weight limit.
During my tests, these recursive searches are usually completed within 2 steps. So I added an arbitrary limit of 5 max recursions to prevent any potential runaways.
The new method is only utilized in the search triggered by the query generator for now. Didn't want to make it default for URL-based searches as it changes the behavior.