使用algolia进行搜索,当使用algolia的自动完成功能时,我得到了由comedienNomComplet
过滤的建议。问题是我想删除此图中显示的comedienNomComplet
的冗余:
这是我的文件:autocomplete.js
:
renderSuggestion(hit) {
//return <Highlight attribute="comedienNom" hit={hit} tagName="mark" />;
return <div className="cm-search-item-container" style={{cursor:"pointer"}}>
{hit.comedienNomComplet}
<hr style={{border: "0.5px solid #2F4A56"}}/>
</div>
}
render() {
const { hits, onSuggestionSelected } = this.props;
const { value } = this.state;
const inputProps = {
placeholder: 'Ex: comédien, amical, documentaire…',
onChange: this.onChange,
value,
};
return (
<AutoSuggest
suggestions={hits}
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
onSuggestionsClearRequested={this.onSuggestionsClearRequested}
onSuggestionSelected={onSuggestionSelected}
getSuggestionValue={this.getSuggestionValue}
renderSuggestion={this.renderSuggestion}
inputProps={inputProps}
/>
);
}
我在recherche.js
中称呼它:
<InstantSearch
indexName="dev_CastingMachine"
searchClient={searchClient}>
<Autocomplete defaultRefinement={localStorage.getItem("motRechercher")} onSuggestionSelected={this.onSuggestionSelected} />
</InstantSearch>
任何帮助将不胜感激。谢谢