Add indices field to _matchesPosition to specify where in an array a match comes from (#5005)

* Remove unreachable code

* Add `indices` field to `MatchBounds`

For matches inside arrays, this field holds the indices of the array
elements that matched. For example, searching for `cat` inside
`{ "a": ["dog", "cat", "fox"] }` would return `indices: [1]`. For nested
arrays, this contains multiple indices, starting with the one for the
top-most array. For matches in fields without arrays, `indices` is not
serialized (does not exist) to save space.
This commit is contained in:
Lukas Kalbertodt 2024-11-20 01:00:43 +01:00 committed by GitHub
parent c1d8ee2a8d
commit 057fcb3993
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 139 additions and 97 deletions

View file

@ -208,7 +208,10 @@ async fn format_nested() {
"doggos.name": [
{
"start": 0,
"length": 5
"length": 5,
"indices": [
0
]
}
]
}