MultiList/MultiDropdownList 在 React 中不显示或抛出错误
MultiList/MultiDropdownList not showing or throwing errors in React
我一直在努力让一些分面搜索选项在 ReactiveSearch/ReactiveBase 中发挥作用。
当尝试让 MultiList 或 MultiDropdownList 工作时,没有显示它应该在的位置,并且在 Dev Tools 中也没有任何错误消息。
SingleRange 部分工作得很好,但我无法使用任何文本 MultiList 功能。
这是我的整个 'render' 部分,以防万一我遗漏了一些简单的东西:
render() {
return (
<ReactiveBase
app="properties"
url="http://<el-server-ip>:9200">
<CategorySearch
componentId="searchbox"
dataField={["PropertyType","County"]}
categoryField="Country"
autoSuggest={true}
fuzziness={0}
queryFormat="and"
placeholder="Search for properties"
/>
<SingleRange
componentId="ratingsfilter"
title="Filter by ratings"
dataField="Price_Unformatted"
data={[
{"start": 0, "end": 500000, "label": "0 - 500k"},
{"start": 500000, "end": 1000000, "label": "500k - 1m"},
{"start": 1000000, "end": 10000000, "label": "1m - 10m"},
{"start": 0, "end": 1000000000000, "label": "10m+"},
]}
/>
<MultiList
componentId="TypeSensor"
dataField="PropertyType.raw"
title="Type"
/>
<ResultCard
componentId="result"
title="Results"
dataField="PropertyType"
from={0}
size={15}
pagination={true}
react={{
and: ["searchbox", "ratingsfilter","TypeSensor"]
}}
onData={(res) => {
return {
image: res.PicNumber,
title: res.PropertyType,
description: res.Description_EN.substr(0,100)
}
}}
/>
</ReactiveBase>
);
}
为了让您了解我正在处理的数据类型,以防万一类型不匹配导致错误:
"_source": {
"objectID": 211956,
"Continent": "Europe",
"Country": "France",
"County": "Aude ",
"Location": "Carcassonne",
"Area": null,
"Price": "EUR 890,000",
"Price_Unformatted": 890000,
"PropertyType": "Chateau",
"Bedrooms": 9,
"Bathrooms": 6,
"PicNumber": "file.jpg",
"Description_EN": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat...",
"Currency": "EUR",
}
在这种情况下,是否有任何方法可以从 React 或 ReactiveSearch 获取某种 output/error 消息,以便我可以准确地了解问题所在?
我之前看到过错误,尽管这些错误主要是语法错误。
A MultiList
必须 运行 提供的 dataField
聚合。从 mappings 开始,您应该使用 keyword
类型,这样聚合就可以 运行 了。因此,如果您将多字段更新为 .keyword
而不是 .raw
,它应该可以工作:
<MultiList
componentId="TypeSensor"
dataField="PropertyType.keyword"
title="Type"
/>
我一直在努力让一些分面搜索选项在 ReactiveSearch/ReactiveBase 中发挥作用。
当尝试让 MultiList 或 MultiDropdownList 工作时,没有显示它应该在的位置,并且在 Dev Tools 中也没有任何错误消息。
SingleRange 部分工作得很好,但我无法使用任何文本 MultiList 功能。
这是我的整个 'render' 部分,以防万一我遗漏了一些简单的东西:
render() {
return (
<ReactiveBase
app="properties"
url="http://<el-server-ip>:9200">
<CategorySearch
componentId="searchbox"
dataField={["PropertyType","County"]}
categoryField="Country"
autoSuggest={true}
fuzziness={0}
queryFormat="and"
placeholder="Search for properties"
/>
<SingleRange
componentId="ratingsfilter"
title="Filter by ratings"
dataField="Price_Unformatted"
data={[
{"start": 0, "end": 500000, "label": "0 - 500k"},
{"start": 500000, "end": 1000000, "label": "500k - 1m"},
{"start": 1000000, "end": 10000000, "label": "1m - 10m"},
{"start": 0, "end": 1000000000000, "label": "10m+"},
]}
/>
<MultiList
componentId="TypeSensor"
dataField="PropertyType.raw"
title="Type"
/>
<ResultCard
componentId="result"
title="Results"
dataField="PropertyType"
from={0}
size={15}
pagination={true}
react={{
and: ["searchbox", "ratingsfilter","TypeSensor"]
}}
onData={(res) => {
return {
image: res.PicNumber,
title: res.PropertyType,
description: res.Description_EN.substr(0,100)
}
}}
/>
</ReactiveBase>
);
}
为了让您了解我正在处理的数据类型,以防万一类型不匹配导致错误:
"_source": {
"objectID": 211956,
"Continent": "Europe",
"Country": "France",
"County": "Aude ",
"Location": "Carcassonne",
"Area": null,
"Price": "EUR 890,000",
"Price_Unformatted": 890000,
"PropertyType": "Chateau",
"Bedrooms": 9,
"Bathrooms": 6,
"PicNumber": "file.jpg",
"Description_EN": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat...",
"Currency": "EUR",
}
在这种情况下,是否有任何方法可以从 React 或 ReactiveSearch 获取某种 output/error 消息,以便我可以准确地了解问题所在?
我之前看到过错误,尽管这些错误主要是语法错误。
A MultiList
必须 运行 提供的 dataField
聚合。从 mappings 开始,您应该使用 keyword
类型,这样聚合就可以 运行 了。因此,如果您将多字段更新为 .keyword
而不是 .raw
,它应该可以工作:
<MultiList
componentId="TypeSensor"
dataField="PropertyType.keyword"
title="Type"
/>