Repository navigation
feat(dao): load a line's cross-references and sources with their books - #138
Merged
Merged
Conversation
getReferencesForLines returns the lines the cross-reference links of some lines reach: REFERENCE and MESORAT_HASHAS in both directions (they are stored once, unoriented), EIN_MISHPAT forward only (its reverse is the SOURCE view). getSourcesForLines returns the SOURCE view in the same shape and order (declared bases first, then base books, then catalog). Each LineReference carries the reached line, the line of the request it starts from, and its book's title, category and catalog rank: all the reader needs to group the places by book and filter them by category, in one query instead of one per book. Signed-off-by: Elie Gambache <elyahou.hadass@gmail.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Two DAO reads for the reader's line panes ("מראי מקומות" and the reworked "מקור"), each one query for any number of lines:
getReferencesForLines(lineIds): the lines the cross-reference links of these lines reach. REFERENCE and MESORAT_HASHAS in both directions (stored once, unoriented); EIN_MISHPAT forward only, since its reverse is already the SOURCE view.getSourcesForLines(lineIds): the SOURCE view in the same shape and the same order asselectInverseLinksByTargetLineIds(declared bases first, then base books, then catalog).Both return
LineReference: the reached line, the request line it starts from (fromLineId), and its book's title, category and catalog rank. That is what the app needs to group places by book and filter them by category, without one query per book. A line is returned once, however many links reach it.Performance
Measured on the current DB: Bereshit 1:1 (164 references, 38 books) in 2–6 ms; Bereshit chapter 1 (31 lines, 412 references) in about 4 ms. Both queries go through the existing
(connectionTypeId, sourceLineId)/(connectionTypeId, targetLineId)indexes.Notes