mirror of
https://github.com/ivabus/www
synced 2024-11-22 07:45:05 +03:00
#294 improve search
This commit is contained in:
parent
53dfe4528c
commit
efcb66d69e
1 changed files with 2 additions and 1 deletions
|
@ -210,9 +210,10 @@
|
|||
function getMatchScore(term, dataset) {
|
||||
// provide higher value with name
|
||||
const { name, description } = dataset;
|
||||
const exactMatch = name.toLocaleLowerCase().includes(term.toLocaleLowerCase());
|
||||
const nameScore = stringSimilarity.compareTwoStrings(name, term);
|
||||
const descriptionScore = stringSimilarity.compareTwoStrings(description, term);
|
||||
return (nameScore*80) + (descriptionScore*20)
|
||||
return (nameScore*80) + (descriptionScore*20) + (exactMatch ? 100 : 0);
|
||||
}
|
||||
|
||||
const loadMoreButton = document.getElementById('loadMorePackagesBtn');
|
||||
|
|
Loading…
Reference in a new issue