我有一个 EDM.string 字段,用于存储由“||”分隔的键值对 和逗号。例如:
{
"CustomField": "1234|||student, 5678||blue, 999||metallica, etc..."
}
我需要执行查询来提取键值组合。例如:
search=5678 blue&searchFields=CustomField&searchMode=all&queryType=full
使用正则表达式,我期望以下应该起作用:
search=/5678.*blue/&queryType=full&searchMode=all
我正在使用默认分析器,所以它似乎忽略了“||”。我试过使用正则表达式但没有成功。是否可以通过键值对进行查询,而不将其存储在 EDM.Collection(string) 上?我想避免新的重新索引过程。提前致谢。
更新
使用集合和新数据集:
{
"@odata.context": "https://[service].search.windows.net/indexes('[index]')/$metadata#docs",
"@odata.count": 3,
"value": [
{
"@search.score": 0.45867884,
"uniqueid": "5",
"Name": null,
"Kvp": [
"1234||sepultura",
"999||programmer",
"876||no education"
],
"Kvp2": "1234||sepultura, 999 programmer, 876||no education"
},
{
"@search.score": 0.38223237,
"uniqueid": "1",
"Name": null,
"Kvp": [
"1234||metallica",
"999||horse education",
"876||high school"
],
"Kvp2": "1234||metallica, 999 horse education, 876||high school"
},
{
"@search.score": 0.38223237,
"uniqueid": "3",
"Name": null,
"Kvp": [
"1234||john mayer",
"999||kid education",
"876||university"
],
"Kvp2": "1234||john mayer, 999 kid education, 876||university"
}
]
}
我的搜索查询如下所示:
Kvp: education&$count=true&queryType=full&searchMode=all
问题是我想避免检索 uniqueid 5 。尽管它具有“教育”作为其中一个标签的值,但它不是 999 键。
也试过:
Kvp: 999||education&$count=true&queryType=full&searchMode=all
Kvp: /.*999.*/ AND /.*education.*/&$count=true&queryType=full&searchMode=all
Kvp: /999.*education/&$count=true&queryType=full&searchMode=all