我正在研究searchkit,我正试图在搜索框中部分搜索搜索结果,但是当数据库中匹配完整文本时结果可用。有没有办法实现这一点,我试过 queryOptions = {{analyzer:" patrial",default_operator:" AND",allow_leading_wildcard:true,analyze_wildcard:true}} 在我的搜索框标签中,但它在搜索时出错。 这是我的搜索框代码:
** <SearchBox
translations={{"searchbox.placeholder":" "}}
autofocus={true}
searchOnChange={true}
// queryOptions=
{{default_operator:"AND"}}
queryOptions={{analyzer: "patrial",
default_operator:"AND", allow_leading_wildcard:
true, analyze_wildcard: true}}
/>**
答案 0 :(得分:0)
尝试使用queryBuilder
组件的SearchBox
中的自定义查询,如下所述:This answer
const customQueryBuilder = (query, options) => {
return {
"multi_match": {
"query": query,
"fields" : [ "field1", "field2", "field3"]
}
}
}
<SearchBox queryBuilder={customQueryBuilder} autofocus={true} queryOptions={{analyzer:"autocomplete", searchOnChange={true} prefixQueryFields={["field1", "field2", "field3"]} />