Merge pull request #4 from nmemmert/claude/test-coverage-analysis-R2olv
Merge feature branch into main
This commit is contained in:
+12
-23
@@ -856,35 +856,24 @@ const App = () => {
|
|||||||
|
|
||||||
const fetchBollsDefinition = async (query) => {
|
const fetchBollsDefinition = async (query) => {
|
||||||
const encoded = encodeURIComponent(query.trim());
|
const encoded = encodeURIComponent(query.trim());
|
||||||
const greekUrl = `https://bolls.life/dictionary-definition/BDAG/${encoded}/`;
|
const dictUrl = `https://bolls.life/dictionary-definition/BDBT/${encoded}/`;
|
||||||
const hebrewUrl = `https://bolls.life/dictionary-definition/BDBT/${encoded}/`;
|
|
||||||
|
|
||||||
if (isHebrewStrongNumber(query)) {
|
// Direct Strong's number lookup (G prefix = Greek/Thayer's, H prefix = Hebrew/BDB)
|
||||||
const response = await fetch(hebrewUrl);
|
if (isGreekStrongNumber(query) || isHebrewStrongNumber(query)) {
|
||||||
|
const response = await fetch(dictUrl);
|
||||||
if (!response.ok) return null;
|
if (!response.ok) return null;
|
||||||
const definitions = await response.json();
|
const definitions = await response.json();
|
||||||
return Array.isArray(definitions) && definitions.length > 0 ? definitions : null;
|
return Array.isArray(definitions) && definitions.length > 0 ? definitions : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Greek Strong's number or unknown — try BDAG (Greek NT lexicon) first.
|
// English word — full-text search, then filter to Greek entries only
|
||||||
const greekResponse = await fetch(greekUrl);
|
const searchResponse = await fetch(`https://bolls.life/search-dictionaries/BDBT/${encoded}/`);
|
||||||
if (greekResponse.ok) {
|
if (searchResponse.ok) {
|
||||||
const greekDefinitions = await greekResponse.json();
|
const results = await searchResponse.json();
|
||||||
if (Array.isArray(greekDefinitions) && greekDefinitions.length > 0) {
|
const greekResults = Array.isArray(results)
|
||||||
return greekDefinitions;
|
? results.filter((r) => String(r.topic ?? '').startsWith('G'))
|
||||||
}
|
: [];
|
||||||
}
|
if (greekResults.length > 0) return [greekResults[0]];
|
||||||
|
|
||||||
// English word — try full-text search filtered to Greek entries.
|
|
||||||
if (!isGreekStrongNumber(query)) {
|
|
||||||
const searchResponse = await fetch(`https://bolls.life/search-dictionaries/BDAG/${encoded}/`);
|
|
||||||
if (searchResponse.ok) {
|
|
||||||
const results = await searchResponse.json();
|
|
||||||
const greekResults = Array.isArray(results)
|
|
||||||
? results.filter((r) => String(r.topic ?? '').startsWith('G'))
|
|
||||||
: [];
|
|
||||||
if (greekResults.length > 0) return [greekResults[0]];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user