【发布时间】:2016-05-11 14:33:43
【问题描述】:
我正在尝试使用部分搜索序列号来查询文档。文档的结构如下:
{
"id": "AAAAA",
"serialNumber": "AAA12345",
"type1Component":
{
"componentId": "component1",
"serialNumber": "BBBCOMPSN1"
},
"type2Component":
{
"componentId": "component2",
"serialNumber": "CCCCOMPSN2"
},
"subComponents": [
"ZZZCOMP9",
"YYYCOMP8",
"XXXCOMP7",
"ZZZCOMP6"
]
}
查询应返回任何顶级或组件序列号包含与输入部分匹配的文档。例如,如果搜索条件为以下任何一项,则上述文档应返回:AAA、BBB、CCC、XXX、YYY、ZZZ
我不知道该怎么做。这是我迄今为止最好的尝试:
SELECT VALUE root FROM root
join comp1 in root.type1Component
join comp2 in root.type2Component
join sub in root.subComponents
where ( contains(upper(root.serialNumber), 'AAA') or
contains(upper(comp1.serialNumber), 'AAA') or
contains(upper(comp2.serialNumber), 'AAA') or
contains(upper(sub), 'AAA')
)
但是这个查询没有命中。谁能告诉我我做错了什么?
【问题讨论】:
标签: azure-cosmosdb