Skip to content

feat(dao): load a line's cross-references and sources with their books - #138

Merged
kdroidFilter merged 1 commit into
masterfrom
feat/line-references
Oct 28, 2026
Merged

kdroidFilter merged 1 commit into
masterfrom
feat/line-references

Conversation

@kdroidFilter

Copy link
Copy Markdown
Owner

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 as selectInverseLinksByTargetLineIds (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

  • Additive only: no schema change, no existing query touched.
  • Used by the Zayit reader (app PR to follow, it bumps this submodule).

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>
@kdroidFilter
kdroidFilter merged commit a2a9a85 into master Oct 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant