improved search for same questions and question variants

This commit is contained in:
GotPPay
2018-04-03 14:49:36 +02:00
parent 4a43dda852
commit ce79c0e1e7

View File

@@ -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);
});