Skip to content

Commit

Permalink
Implement
Browse files Browse the repository at this point in the history
  • Loading branch information
williambelle committed Jul 3, 2024
1 parent 43fefa0 commit c6ce4ae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils/ldap.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ function score (a, q) {
term = term.toLowerCase();
for (const attr of attributes) {
const name = util.removeAccents(a[attr]).toLowerCase();
const subnames = name.split(/\s+/);
if (name === term && attr === 'name') {
points += 4;
points += 100;
} else if (name === term && attr === 'firstname') {
points += 3;
points += 99;
} else if (subnames.includes(term)) {
points += 49;
} else if (name.startsWith(term) && attr === 'name') {
points += 2;
} else if (name.startsWith(term) && attr === 'firstname') {
Expand Down

0 comments on commit c6ce4ae

Please sign in to comment.