我在索引文件中有以下数据
[
{
"HotelId": "1",
"HotelName": "Secret Point Motel",
"Description": "Ideally located on the main commercial artery of the city in the heart of New York.",
"Tags": [
"Free wifi",
"on-site **park**ing",
"indoor pool",
"continental breakfast"
],
"Address": {
"StreetAddress": "677 5th Ave",
"City": "New York",
"StateProvince": "NY"
}
},
{
"HotelId": "2",
"HotelName": "SBS Greenotel",
"Description": "Ideally located on the main commercial artery of the city in the heart of New York.",
"Tags": [
"Free wifi",
"Paid wifi",
"on-site **park**ing",
"podium **park**ing",
"indoor pool",
"continental breakfast"
],
"Address": {
"StreetAddress": "677 5th Ave",
"City": "New York",
"StateProvince": "NY"
}
}
]
字符串
并且想搜索标签中包含或匹配搜索短语 “公园”(以上数据中 * 突出显示 *)的酒店
我尝试了search.ismatch函数,但lambda表达式不支持它。
任何帮助形成odata查询将不胜感激。
1条答案
按热度按时间g52tjvyc1#
一个可能的解决方案是在索引模式中包含
analyzer
,以实现关键字的部分匹配。我创建了一个索引,下面的schema:
字符串
并上传了以下数据:
型
使用标签字段分析器,我可以通过搜索查询获得结果:“park”
**注意:**请根据您的需求修改schema。
有关详细信息,请参阅此文档。
你也可以用类似的问题检查这个thread。