Optimize MyBible WordsOfChrist fallback query#3671
Open
JyriWee wants to merge 4 commits intoAndBible:current-stablefrom
Open
Optimize MyBible WordsOfChrist fallback query#3671JyriWee wants to merge 4 commits intoAndBible:current-stablefrom
JyriWee wants to merge 4 commits intoAndBible:current-stablefrom
Conversation
Follow up Copilot review on PR AndBible#3670 by removing lower(text) from the fallback scan. Check both <J> and <j> directly and keep LIMIT 1; add a unit test to lock in the query shape.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes the WordsOfChrist fallback detection query in MyBibleBook.kt (a follow-up to #3670). Instead of applying lower(text) over the entire verses table for a case-insensitive <J> tag match, the query now uses two separate instr() checks for <J> and <j> directly, avoiding the per-row lower() function call. The SQL is also extracted into a named constant for reuse and testability.
Changes:
- Replaced
instr(lower(text), '<j>')withinstr(text, '<J>') > 0 OR instr(text, '<j>') > 0in the fallback detection query, and extracted it intoWORDS_OF_CHRIST_MARKUP_QUERY - Added a unit test to assert the query constant contains the expected
instrexpressions andlimit 1 - Updated the
labeled.ymlGitHub Actions workflow to guard theadd-to-projectstep against forks and missing secrets
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
app/src/main/java/net/bible/service/sword/mybible/MyBibleBook.kt |
Extracts SQL into WORDS_OF_CHRIST_MARKUP_QUERY constant and replaces the inline lower(text) query |
app/src/test/java/net/bible/service/sword/mybible/MyBibleBookTest.kt |
Adds test asserting the constant query contains expected case-handling substrings |
.github/workflows/labeled.yml |
Adds name and an if: guard to prevent the project-add step from running on forks or when the secret is absent |
app/src/test/java/net/bible/service/sword/mybible/MyBibleBookTest.kt
Outdated
Show resolved
Hide resolved
Contributor
Author
|
Merge-ready summary (2026-03-04):
From this side PR #3671 is ready for maintainer approval/merge. |
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.
What changed
MyBibleBook.ktto avoidlower(text)on theversestable.<J>and<j>directly and keepsLIMIT 1:instr(text, '<J>') > 0 OR instr(text, '<j>') > 0WORDS_OF_CHRIST_MARKUP_QUERYconstant.Benefits
lower()on scanned verse text rows.<J>tag detection.Possible side effects
<J>/<j>markup.Validation
./gradlew :app:testStandardGithubDebugUnitTest --tests net.bible.service.sword.mybible.MyBibleBookTest --no-daemon./gradlew :app:assembleStandardGithubDebug -x jsBuild --no-daemonFollow-up to Copilot review comment on #3670: