是否可以在搜索定义中的 JSON 对象内创建一个 JSON 数组,并且所有字段都可以在 vespa.ai 中搜索?
Is it possible to create a JSON array inside a JSON object in search definition and all fields are searchable in vespa.ai?
我需要在 Vespa 中创建一个搜索定义文件,我可以在 JSON 对象中创建一个 JSON 数组,所有字段都可搜索
例如-
{
"department": "education",
"designation": "student",
"person": {
"name": "steve",
"city": "delhi",
"hobbies": [
{
"hobbyName": "cricket",
"type": "outdoor"
},
{
"hobbyName": "chess",
"type": "indoor"
}
]
}
}
这里需要搜索一个person.name,person.city,person.hobbies.hobbyName,person.hobbies.type.
使用 array of struct ,像这样的事情应该让你开始:
search person {
document person {
field name type string {
indexing: summary | index
}
field city type string {
indexing: summary | index
}
struct hobby {
field hobbyName type string {}
field type type string {}
}
field hobbies type array<hobby> {
indexing: summary
struct-field hobbyName { indexing: attribute }
struct-field type { indexing: attribute }
}
}
}
我需要在 Vespa 中创建一个搜索定义文件,我可以在 JSON 对象中创建一个 JSON 数组,所有字段都可搜索
例如-
{
"department": "education",
"designation": "student",
"person": {
"name": "steve",
"city": "delhi",
"hobbies": [
{
"hobbyName": "cricket",
"type": "outdoor"
},
{
"hobbyName": "chess",
"type": "indoor"
}
]
}
}
这里需要搜索一个person.name,person.city,person.hobbies.hobbyName,person.hobbies.type.
使用 array of struct ,像这样的事情应该让你开始:
search person {
document person {
field name type string {
indexing: summary | index
}
field city type string {
indexing: summary | index
}
struct hobby {
field hobbyName type string {}
field type type string {}
}
field hobbies type array<hobby> {
indexing: summary
struct-field hobbyName { indexing: attribute }
struct-field type { indexing: attribute }
}
}
}