(b []byte)
| 1258 | } |
| 1259 | |
| 1260 | func (j jsonArray) encodeInvertedIndexKeys(b []byte) ([][]byte, error) { |
| 1261 | // Checking for an empty array. |
| 1262 | if len(j) == 0 { |
| 1263 | return [][]byte{encoding.EncodeJSONEmptyArray(b)}, nil |
| 1264 | } |
| 1265 | |
| 1266 | prefix := encoding.EncodeArrayAscending(b) |
| 1267 | var outKeys [][]byte |
| 1268 | for i := range j { |
| 1269 | children, err := j[i].encodeInvertedIndexKeys(prefix[:len(prefix):len(prefix)]) |
| 1270 | if err != nil { |
| 1271 | return nil, err |
| 1272 | } |
| 1273 | outKeys = append(outKeys, children...) |
| 1274 | } |
| 1275 | |
| 1276 | // Deduplicate the entries, since arrays can have duplicates - we don't want |
| 1277 | // to emit duplicate keys from this method, as it's more expensive to |
| 1278 | // deduplicate keys via KV (which will actually write the keys) than to do |
| 1279 | // it now (just an in-memory sort and distinct). |
| 1280 | outKeys = deduplicate.ByteSlices(outKeys) |
| 1281 | return outKeys, nil |
| 1282 | } |
| 1283 | |
| 1284 | func (j jsonArray) encodeContainingInvertedIndexSpans( |
| 1285 | b []byte, isRoot, isObjectValue bool, |
no test coverage detected