hldp(zhuyuan): integrate fifth-domain world tree and TCS brain
This commit is contained in:
parent
9782d04246
commit
4496f75857
42 changed files with 1720 additions and 268 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue