-
Notifications
You must be signed in to change notification settings - Fork 90
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
Faceted Search: fix infinite recursion on duplicate facets #3799
Conversation
nl0
commented
Nov 28, 2023
•
edited
Loading
edited
- Unit tests
- Changelog entry (skip if change is not significant to end users, e.g. docs only)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3799 +/- ##
===========================================
+ Coverage 34.71% 89.15% +54.43%
===========================================
Files 709 79 -630
Lines 31063 9899 -21164
Branches 4638 0 -4638
===========================================
- Hits 10783 8825 -1958
+ Misses 19131 1074 -18057
+ Partials 1149 0 -1149
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
What is a source of this conflict? Can we make it so it doesn't happen?
Few suggestions to make code more readable for me, if you care:
- don't use abbreviations when not necessary:
KTree
→KeyedTree
, it requires additional energy to keep in mind whatK
means const children = new Map(a.children)
→const aChildren = new Map(a.children)
, to not confuse withb.children
resolveFacetConflict
→mergeDuplicateFacets
. Resolve - is a function under-the-hood, but merge duplicates is what function's intention
not sure tbh. like, it shouldn't be happening, but for some reason it does -- i wasn't able to determine the root cause on the back-end yet. anyways, it's better to not crash on it, just record the fact and continue normal operation.
it's not a's children, it's resulting children, which is initialized with the value of a, and then merged with b, so it will be incorrect to label it
that's not quite true, because 1) this function is called "resolve" in Tree's api -- it's used to resolve conflicts (entries with conflicting keys) while merging the trees, and 2) it's purpose is not to merge duplicate facets (this is only an edge case that shouldn't be happening at all), it is to rebuild the [part of the] tree representing the hierarchy of facets to expose differently-typed facets with the same path. |