From a3daa13011b59c6f898e5803c7198c760b792dfc Mon Sep 17 00:00:00 2001 From: Alexandru Stefan Date: Wed, 3 Nov 2021 18:44:59 +0200 Subject: [PATCH] fixed searching in workspace --- Desktop/UI/Globals.js | 10 +++------- .../Education/UI/Spaces/Docs-Space/SearchEngine.js | 5 ++--- .../UI/Spaces/Docs-Space/SearchResultsPage.js | 6 +++--- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Desktop/UI/Globals.js b/Desktop/UI/Globals.js index 4fcff6c27..4599bca36 100644 --- a/Desktop/UI/Globals.js +++ b/Desktop/UI/Globals.js @@ -1,4 +1,4 @@ - +/* Root object*/ /* Root objects*/ let UI = { projects: {}, @@ -7,14 +7,10 @@ let UI = { running: {} } -let SA = { - projects: {} , - nodeModules: { - flexSearch: require("flexsearch") - } -} +let SA = { projects: {} } /* We will use this to load functions originally intended for Nodejs */ let exports = {} + diff --git a/Projects/Education/UI/Spaces/Docs-Space/SearchEngine.js b/Projects/Education/UI/Spaces/Docs-Space/SearchEngine.js index c93df4b6c..1cb378839 100644 --- a/Projects/Education/UI/Spaces/Docs-Space/SearchEngine.js +++ b/Projects/Education/UI/Spaces/Docs-Space/SearchEngine.js @@ -14,7 +14,7 @@ function newFoundationsDocsSearchEngine() { thisObject.documentIndex = new FlexSearch.Document({ preset: "performance", worker: true, - encoder: "extra", + encoder: "advanced", tokenize: "full", document: { index: [ @@ -225,7 +225,7 @@ function newFoundationsDocsSearchEngine() { } if (docsSchemaDocument.definition !== undefined) { let paragraph = { - text: docsSchemaDocument.definition, + text: docsSchemaDocument.definition.text, translations: docsSchemaDocument.definition.translations } appendToTextField(paragraph.text) @@ -262,7 +262,6 @@ function newFoundationsDocsSearchEngine() { } - } function setUpWorkspaceSchemas() { diff --git a/Projects/Education/UI/Spaces/Docs-Space/SearchResultsPage.js b/Projects/Education/UI/Spaces/Docs-Space/SearchResultsPage.js index 318068271..26f858713 100644 --- a/Projects/Education/UI/Spaces/Docs-Space/SearchResultsPage.js +++ b/Projects/Education/UI/Spaces/Docs-Space/SearchResultsPage.js @@ -17,17 +17,17 @@ function newFoundationsDocsSearchResultsPage() { function render() { - let index = UI.projects.education.spaces.docsSpace.searchEngine.documentIndex + let docIndex = UI.projects.education.spaces.docsSpace.searchEngine.documentIndex let resultsArray = [] let initialTime = new Date() - let searchByType = index.search(UI.projects.education.spaces.docsSpace.commandInterface.command.toLowerCase(), { + let searchByType = docIndex.search(UI.projects.education.spaces.docsSpace.commandInterface.command.toLowerCase(), { pluck: 'docsSchemaDocument:type', enrich: true, limit: 10000 }) - let searchByText = index.search(UI.projects.education.spaces.docsSpace.commandInterface.command.toLowerCase(), { + let searchByText = docIndex.search(UI.projects.education.spaces.docsSpace.commandInterface.command.toLowerCase(), { pluck: 'text', enrich: true, limit: 10000