-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the block and patterns search algorithm #25105
Conversation
557e638
to
6a15336
Compare
Size Change: +171 B (0%) Total Size: 1.2 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
Co-authored-by: Miguel Fonseca <[email protected]>
Co-authored-by: Miguel Fonseca <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably add a unit test searchItems
new ordering. Other than that and some minor comments this looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one! 💯
closes #14868
closes #24651
This PR improves the search algorithm for blocks and patterns by implementing a rank-based search:
The blocks are ordered as follows:
Also, if the block is a "core" block, it has a bonus point.
Note that the search algorithm doesn't work properly for block variations, the issue there is not from the search algorithm but more from the inserter where we consider the variations and the blocks as a single "item". A separate refactoring should be done to improve that.