hldp(zhuyuan): integrate fifth-domain world tree and TCS brain

This commit is contained in:
冰朔 2026-07-27 13:38:04 +08:00
commit 4496f75857
42 changed files with 1720 additions and 268 deletions

View file

@ -29,10 +29,11 @@ function search(map, query) {
repository.state, ...(repository.keywords || []),
].join(" "));
const score = terms.reduce((total, term) => total + (haystack.includes(term) ? 1 : 0), 0);
return { repository, score };
const currentEntry = repository.code === map.default_repository ? 1 : 0;
return { repository, score, currentEntry };
})
.filter(item => item.score > 0)
.sort((a, b) => b.score - a.score || a.repository.code.localeCompare(b.repository.code))
.sort((a, b) => b.score - a.score || b.currentEntry - a.currentEntry || a.repository.code.localeCompare(b.repository.code))
.map(item => item.repository);
}