From 794249ade639777c5b3df36308c0386d74cef955 Mon Sep 17 00:00:00 2001 From: Nekori Date: Wed, 28 Apr 2021 13:10:50 +0200 Subject: [PATCH] Upgrade: Recherche --- html/baseTemplate.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/html/baseTemplate.js b/html/baseTemplate.js index e16a9c9..ab760cd 100644 --- a/html/baseTemplate.js +++ b/html/baseTemplate.js @@ -28,8 +28,10 @@ $("document").ready(function() { }); $("#rechercher").keyup(function(e) { - var recherche = $(this).val(); + var recherche = $(this).val().trim(); if(recherche.length != 0) { + recherche = "+" + recherche.replace(/\s+/g," +"); + console.log(recherche) var resultats = idx.search(recherche); if(resultats.length != 0) { $("#rechercheResultats").empty(); @@ -50,9 +52,9 @@ var documents = {{documents}} var idx = lunr(function() { this.ref("code") - this.field("code") + this.field("code", { boost: 10}) this.field("motscles") - this.field("diminutif") + this.field("diminutif", { boost: 10}) this.field("titre") for(var cle in documents) {