Fix lookup: replace invalid BDAG dictionary code with BDBT which bolls.life actually supports

This commit is contained in:
Claude
2026-05-27 17:23:01 +00:00
parent b0d36bf770
commit 1f938475ed
+12 -23
View File
@@ -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;