Warning: session_start(): open(/var/lib/php/sessions/sess_g7kerhc41d1ii307101uufuodt, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
srecord Result(S text, S moduleID, double value) {}
module QuickSearchManager > DynQuickSearch {
transient S resultsQuery;
transient Map> resultsByModule = synchroMap();
LS calc_impl() {
L results = concatLists(cloneValues(getResultsByModule()));
sortByFieldDesc_inPlace(results, 'value);
ret collect('text, takeFirst(50, results));
}
// clear if query changed
Map> getResultsByModule() {
synchronized(resultsByModule) {
if (neq(resultsQuery, query))
resultsByModule.clear();
ret resultsByModule;
}
}
// API
void setResultsForModule(fS moduleID, S query, LS results) {
synchronized(resultsByModule) {
if (neq(resultsQuery, query)) ret;
getResultsByModule().put(moduleID, map(results, func(S s) -> Result { Result(s, moduleID, 0) }));
}
// show/update list
if (nempty(results))
doSearch(resultsQuery);
}
}