@@ -42,13 +42,13 @@ const renderData = data => {
42
42
43
43
const renderDataNew = data => {
44
44
var listOfSuggestions = [ ] ,
45
- firstResponseValue = [ ]
45
+ responseSuggestions = [ ]
46
46
// const maxScore = data.hits.max_score
47
47
data . hits . hits . map ( ( value , index ) => {
48
48
listOfSuggestions . push ( `${ value . _source . tags } (score -- ${ value . _score . toFixed ( 2 ) } )` )
49
- if ( index === 0 || index === 1 || index === 2 ) { firstResponseValue . push ( value . _source . tags ) } // for do you mean
49
+ responseSuggestions . push ( value . _source . tags ) // for do you mean
50
50
} )
51
- return [ listOfSuggestions , firstResponseValue ]
51
+ return [ listOfSuggestions , responseSuggestions ]
52
52
}
53
53
54
54
class AutoSuggest extends React . Component {
@@ -60,7 +60,7 @@ class AutoSuggest extends React.Component {
60
60
showResults : false ,
61
61
searchResult : [ ] ,
62
62
searchValue : '' ,
63
- firstResponseValue : [ ]
63
+ responseSuggestions : [ ]
64
64
} ;
65
65
}
66
66
@@ -87,7 +87,7 @@ class AutoSuggest extends React.Component {
87
87
if ( data !== undefined ) {
88
88
this . setState ( {
89
89
suggestions : data [ 0 ] ,
90
- firstResponseValue : data [ 1 ]
90
+ responseSuggestions : data [ 1 ]
91
91
} )
92
92
}
93
93
} )
@@ -140,8 +140,8 @@ class AutoSuggest extends React.Component {
140
140
}
141
141
142
142
render ( ) {
143
- const { value, suggestions, searchValue, firstResponseValue } = this . state ;
144
- // console.log(value, suggestions )
143
+ const { value, suggestions, searchValue, responseSuggestions } = this . state ;
144
+ // console.log(value, responseSuggestions, responseSuggestions.includes(value) )
145
145
// Autosuggest will pass through all these props to the input.
146
146
const inputProps = {
147
147
placeholder : 'Search ...' ,
@@ -169,7 +169,7 @@ class AutoSuggest extends React.Component {
169
169
this . state . showResults
170
170
? < ListIndex searchResult = { this . state . searchResult }
171
171
searchValue = { value }
172
- firstResponseValue = { firstResponseValue }
172
+ responseSuggestions = { responseSuggestions }
173
173
searchSuggestedValue = { this . searchSuggestedValue }
174
174
/>
175
175
: null
0 commit comments