From ce79c0e1e7726a624bff5dd20e210cb47932d152 Mon Sep 17 00:00:00 2001 From: GotPPay Date: Tue, 3 Apr 2018 14:49:36 +0200 Subject: [PATCH] improved search for same questions and question variants --- web/src/App.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/src/App.js b/web/src/App.js index 7d1e21b..cd6e3eb 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -257,10 +257,13 @@ class App extends Component { //will be kept in filteredIntents. After filterring, there should be only one //intent left, the selected one + let selectedIntentQuestionsForSearch = selectedIntent.questions.map(question=> + question.toLowerCase().trim()); + let filteredIntents = this.state.allIntents.filter(intent=>{ - let result = (selectedIntent.intentName === intent.intentName); + let result = (selectedIntent.intentName.toLowerCase().trim() === intent.intentName.toLowerCase().trim()); let filteredQuestions = intent.questions.filter(question=>{ - return (selectedIntent.questions.indexOf(question)!==-1); + return (selectedIntentQuestionsForSearch.indexOf(question.toLowerCase().trim())!==-1); }); return (result || filteredQuestions.length > 0); });