diff --git a/assets/js/src/search.js b/assets/js/src/search.js index 739cfc5908..7fc01b95d1 100644 --- a/assets/js/src/search.js +++ b/assets/js/src/search.js @@ -18,8 +18,11 @@ async function initializeIndex() { { name: "keywords", weight: 1 }, { name: "tags", weight: 1 }, ], - minMatchCharLength: 2, + minMatchCharLength: 1, threshold: 0.2, + ignoreLocation: true, + useExtendedSearch: true, + ignoreFieldNorm: true, }; handler = new Fuse(index, options); @@ -28,17 +31,17 @@ async function initializeIndex() { async function executeSearch(query) { !indexed && (await initializeIndex()); - const results = handler.search(query).map(({ item }) => item); - return results + const results = handler.search(query); + return results; } async function modalSearch(e) { const query = e.target.value; - results = await executeSearch(query) + results = await executeSearch(query); let resultsHTML = `
${results.length} results
`; resultsHTML += results - .map((item) => { + .map(({ item }) => { return `
${item.title}