Widget:BcaSearch: Difference between revisions
(Search: passages open in the bilingual view, faster class buttons, search tips) |
(Search: results first, counts after) |
||
| Line 223: | Line 223: | ||
var key = state.q + '|' + state.cls; | var key = state.q + '|' + state.cls; | ||
var cached = (g.id === 'library' && state.cls && state.offset === 0 && firstPages[key]); | var cached = (g.id === 'library' && state.cls && state.offset === 0 && firstPages[key]); | ||
(cached ? $.Deferred().resolve(cached).promise() : search(g, g.id === 'library' ? state.cls : '', state.offset, PAGE)).then(function (r) { | return (cached ? $.Deferred().resolve(cached).promise() : search(g, g.id === 'library' ? state.cls : '', state.offset, PAGE)).then(function (r) { | ||
if (my !== token) return; | if (my !== token) return; | ||
var hits = r.search || []; | var hits = r.search || []; | ||
| Line 280: | Line 280: | ||
counts = {}; | counts = {}; | ||
renderTabs(); | renderTabs(); | ||
// The results come first; the counts follow once they are on screen, so the | |||
// | // first page is not queued behind eleven count searches (and a class button | ||
$.when.apply($, GROUPS.map(function (g) { | // clicked early does not wait behind them either). | ||
var listDone = loadList(false) || $.Deferred().resolve().promise(); | |||
listDone.always(function () { $.when.apply($, GROUPS.map(function (g) { | |||
return search(g, '', 0, 1).then(function (r) { counts[g.id] = r.searchinfo.totalhits; }, function () { counts[g.id] = 0; }); | return search(g, '', 0, 1).then(function (r) { counts[g.id] = r.searchinfo.totalhits; }, function () { counts[g.id] = 0; }); | ||
})).always(function () { | })).always(function () { | ||
| Line 292: | Line 294: | ||
})).always(function () { renderPills(cc); }); | })).always(function () { renderPills(cc); }); | ||
} | } | ||
}); | }); }); | ||
} | } | ||
Revision as of 19:47, 2 October 2026
Site search for the Bodhicitta wiki (preview). Used on Advanced Search/Preview. Full-text search through CirrusSearch, results grouped (library, passages in the aligned texts, essays, topics, people), class filters with counts, the library's bibliographic rows, and the search kept in the page address so it can be shared.