-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
Include charts' parent tags in the algolia index #3790
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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 understand that this code works, but the structure of how we're building and working with this graph is more complex than it needs to be.
For example, you need to build the graph twice, once flat, once with the object model, and you also need to do a second query to fetch the tag names. You have to rewrite the parents multiple times instead of computing it just once.
A more standard graph representation would be something like
idToNode
(and maybeidToChildIds
oridToParentId
), and would make the subsequent traversal much easier. Then you also skip entirely the fake root node.In this case, the flat tag graph is basically
idToChildNodes
, plus the root id. The graph would be better if it was justidToNode
, ungrouped, since the node already contains the parent id. Let's imagine that scenario.It becomes easy to iterate across every node, and easy to follow the parent chain for every node too.
How much would that mess up other code elsewhere?
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 think maybe #3800 might be adding some confusion here 😛
A few things:
tag_graph
table (not the tags'parentId
column) a node can have multiple parents:The fake root node was added as a simple way to coexist with a
tags
table that has non-topic/area tags in it. Anything that's a child of the root tag node is part of the graph. Things that aren't (e.g.Abstract
) can be ignored.If I hadn't already written code for the tag graph UI, I could have written this function with
idToParentIds
andidToNode
maps, but given I had those 2 functions already (which, if you squint, create the same data structure) it seemed simpler at the time to do it this way.We should have a call about this to make sure I'm understanding you correctly though. 🙂