
search=手动 同步&$orderby=search.score() desc&$top=2&$count=true
{
"@odata.context": "https://niutest-search.search.windows.net/indexes('wiki')/$metadata#docs(*)",
"@odata.count": 6,
"value": [
{
"@search.score": 3.4546685,
"id": "e473144a38075674de8163930dabdb03340570be",
"locale": "zh",
"path": "niuguyue/2ndpage",
"title": "常用操作",
"description": "",
"content": "在家庭中手机翻墙 手机翻墙, 在无线的代理中设置手动,对于苹果手机,选择 设置 》无线局域网 》chinanet 9wuj 》配置代理 》手动 服务器填写 gw.niuhongxing.cn 端口填写1087, 如下图所示 家庭存储的位置 192.168.1.135 github账号 user: hongxing.niu gmail.com pass: },
{
"@search.score": 3.2120147,
"id": "0815a72d8b8b138e26e18e3a780539ce27e4f4b3",
"locale": "zh",
"path": "niuguyue/esdp注意事项",
"title": "esdp注意事项",
"description": "",
"content": "注意 原始链接: https mp.weixin.qq.com 6arvw1uehf gslsig 1dw q:复选报到地点 1、普陀区长寿路868号中港汇一楼门口 ,开车到车库的选手务必到1楼中港汇门口签到。 2、建议路线:地铁13号线到武宁路地铁站1号口出100米左右。 3、复选场地组委会无车位提供,根据以往情况建议家长不要开车到现场,或者就近停车步行到现场! q:关于时间段的说明 a:选手在自己选择时间段内任意时刻到达即可,随到随安排参加报到,完成报到后即可等待参加复选,就像去银行办业务。 }
]
}
count=true&牙牙牙&filter=search.in(title, '第九人民医院')
{ "@odata.context": "https://niutest-search.search.windows.net/indexes('wiki')/$metadata#docs(*)", "@odata.count": 1, "value": [ { "@search.score": 1, "id": "f0e02452768bd90db1fb5efc3ea099f2fd0e73ae", "locale": "zh", "path": "niuguyue/teethTeethTeeth", "title": "第九人民医院", "description": "关于牙牙牙", "content": "龋齿,蛀牙 什么是龋齿,怎么刷牙对,听专家怎么说 蛀牙清晰结构图 蛀牙很重要,要好好处理 刷牙刷刷刷 怎么正确刷牙 义齿和种牙活动页宣传 可摘局部义齿 可摘局部义齿是对于患者牙列缺损所采取的一种活动假牙修复方式,一般在拔牙后3月进行修复。 治疗中,需根 }
count=true&牙牙牙&filter=title/all(g,search.in(g, '第九人民医院'))
$select=HotelId, HotelName, Rating, Address/City
$orderby=Rating desc,BaseRate
$filter=HotelName ne 'Sea View Motel' and LastRenovationDate ge 2010-01-01T00:00:00Z
| 数据类型 | 示例常量 |
|---|---|
| Edm.Boolean | true, false |
| Edm.DateTimeOffset | 2019-05-06T12:30:05.451Z |
| Edm.Double | 3.14159, -1.2e7, NaN, INF, -INF |
| Edm.GeographyPoint | geography'POINT(-122.131577 47.678581)' |
| Edm.GeographyPolygon | geography'POLYGON((-122.031577 47.578581, -122.031577 47.678581, -122.131577 47.678581, -122.031577 47.578581))' |
| Edm.Int32 | 123, -456 |
| Edm.Int64 | 283032927235 |
| Edm.String | 'hello' |
参见 Azure 认知搜索中 orderby 和 $select 的 OData 语言概述
| 字段路径 | 说明 |
|---|---|
| HotelName | 引用索引的顶级字段 |
| Address/City | 引用索引中复杂字段的 City 子字段;在此示例中,Address 的类型为 Edm.ComplexType |
| Rooms/Type | 引用索引中复杂集合字段的 Type 子字段;在此示例中,Rooms 的类型为 Collection(Edm.ComplexType) |
OData 全文搜索函数 - search.ismatch
#1. 只有title中包含“第九人民医院”严格字符串的文章筛选出来,只打印title和命中的总数
$filter=search.ismatch('"第九人民医院"','title')&$count=true&$select=title
results:
{
"@odata.context": "https://niutest-search.search.windows.net/indexes('wiki')/$metadata#docs(*)",
"@odata.count": 1,
"value": [
{
"@search.score": 1,
"title": "第九人民医院"
}
]
}
#2. 默认搜索所有字段, 第二个文章,因为正文中有这个字符串
$filter=search.ismatch('"第九人民医院"')&$count=true&$select=title
results:
{
"@odata.context": "https://niutest-search.search.windows.net/indexes('wiki')/$metadata#docs(*)",
"@odata.count": 2,
"value": [
{
"@search.score": 1,
"title": "第九人民医院"
},
{
"@search.score": 1,
"title": "AI&CLoud Enabled search"
}
]
}
#3. 先分词,再搜索,把字符串的双引号去掉了,会把搜索字符串分为,第,九,人民,医院
$filter=search.ismatch('第九人民医院', title)&$count=true&$select=title
{
"@odata.context": "https://niutest-search.search.windows.net/indexes('wiki')/$metadata#docs(*)",
"@odata.count": 3,
"value": [
{
"@search.score": 1,
"title": "中山医院"
},
{
"@search.score": 1,
"title": "第九人民医院"
},
{
"@search.score": 1,
"title": "20220125翟东升我的第一辆电动车"
}
]
}
和 search.ismatchscoring函数
Azure Cognitive Search lets you specify different analyzers for indexing and search via additional indexAnalyzer and searchAnalyzer field parameters. If unspecified, the analyzer set with the analyzer property is used for both indexing and searching.