From 5637c55b7f8f812d01b213ddb1d3174ab26939fa Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sun, 6 Oct 2024 01:15:13 +0200 Subject: [PATCH] [icons] Try sync index addition --- .../components/material-icons/SearchIcons.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/data/material/components/material-icons/SearchIcons.js b/docs/data/material/components/material-icons/SearchIcons.js index 945dcc038ff325..9fbd70f2488031 100644 --- a/docs/data/material/components/material-icons/SearchIcons.js +++ b/docs/data/material/components/material-icons/SearchIcons.js @@ -518,29 +518,31 @@ const searchIndex = new FlexSearchIndex({ tokenize: 'full', }); +const nameCleanRegex = /(Outlined|TwoTone|Rounded|Sharp)$/; + const allIconsMap = {}; const allIcons = Object.keys(mui) .sort() .map((importName) => { let theme; - if (importName.includes('Outlined')) { + if (importName.endsWith('Outlined')) { theme = 'Outlined'; - } else if (importName.includes('TwoTone')) { + } else if (importName.endsWith('TwoTone')) { theme = 'Two tone'; - } else if (importName.includes('Rounded')) { + } else if (importName.endsWith('Rounded')) { theme = 'Rounded'; - } else if (importName.includes('Sharp')) { + } else if (importName.endsWith('Sharp')) { theme = 'Sharp'; } else { theme = 'Filled'; } - const name = importName.replace(/(Outlined|TwoTone|Rounded|Sharp)$/, ''); + const name = importName.replace(nameCleanRegex, ''); let searchable = name; if (synonyms[searchable]) { searchable += ` ${synonyms[searchable]}`; } - searchIndex.addAsync(importName, searchable); + searchIndex.add(importName, searchable); const icon = { importName,