improved search for same questions and question variants
This commit is contained in:
@@ -257,10 +257,13 @@ class App extends Component {
|
|||||||
//will be kept in filteredIntents. After filterring, there should be only one
|
//will be kept in filteredIntents. After filterring, there should be only one
|
||||||
//intent left, the selected one
|
//intent left, the selected one
|
||||||
|
|
||||||
|
let selectedIntentQuestionsForSearch = selectedIntent.questions.map(question=>
|
||||||
|
question.toLowerCase().trim());
|
||||||
|
|
||||||
let filteredIntents = this.state.allIntents.filter(intent=>{
|
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=>{
|
let filteredQuestions = intent.questions.filter(question=>{
|
||||||
return (selectedIntent.questions.indexOf(question)!==-1);
|
return (selectedIntentQuestionsForSearch.indexOf(question.toLowerCase().trim())!==-1);
|
||||||
});
|
});
|
||||||
return (result || filteredQuestions.length > 0);
|
return (result || filteredQuestions.length > 0);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user