#294 include maintainer in search

This commit is contained in:
neil molina 2023-03-22 07:48:13 +08:00
parent efcb66d69e
commit d3e1a4066d

View file

@ -209,8 +209,8 @@
function getMatchScore(term, dataset) { function getMatchScore(term, dataset) {
// provide higher value with name // provide higher value with name
const { name, description } = dataset; const { name, maintainer, description } = dataset;
const exactMatch = name.toLocaleLowerCase().includes(term.toLocaleLowerCase()); const exactMatch = [maintainer, name].join(" ").toLocaleLowerCase().includes(term.toLocaleLowerCase());
const nameScore = stringSimilarity.compareTwoStrings(name, term); const nameScore = stringSimilarity.compareTwoStrings(name, term);
const descriptionScore = stringSimilarity.compareTwoStrings(description, term); const descriptionScore = stringSimilarity.compareTwoStrings(description, term);
return (nameScore*80) + (descriptionScore*20) + (exactMatch ? 100 : 0); return (nameScore*80) + (descriptionScore*20) + (exactMatch ? 100 : 0);