From d3e1a4066d74c7e525172d3e0d5ae6a1b92c60aa Mon Sep 17 00:00:00 2001 From: neil molina Date: Wed, 22 Mar 2023 07:48:13 +0800 Subject: [PATCH] #294 include maintainer in search --- src/layouts/partials/package-grid.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layouts/partials/package-grid.html b/src/layouts/partials/package-grid.html index 586c2da..85c1396 100644 --- a/src/layouts/partials/package-grid.html +++ b/src/layouts/partials/package-grid.html @@ -209,8 +209,8 @@ function getMatchScore(term, dataset) { // provide higher value with name - const { name, description } = dataset; - const exactMatch = name.toLocaleLowerCase().includes(term.toLocaleLowerCase()); + const { name, maintainer, description } = dataset; + const exactMatch = [maintainer, name].join(" ").toLocaleLowerCase().includes(term.toLocaleLowerCase()); const nameScore = stringSimilarity.compareTwoStrings(name, term); const descriptionScore = stringSimilarity.compareTwoStrings(description, term); return (nameScore*80) + (descriptionScore*20) + (exactMatch ? 100 : 0);