diff options
| author | 2022-11-26 05:29:09 +0100 | |
|---|---|---|
| committer | 2022-11-26 05:29:09 +0100 | |
| commit | 405bf6b8e4241252ed7bde917a21e0c57d4bab70 (patch) | |
| tree | 5a43fa06aae5a8c0e5ab6ccc91d46023cd14efc7 /data.c | |
| parent | New function object_add_ow(). (diff) | |
| download | snac2-405bf6b8e4241252ed7bde917a21e0c57d4bab70.tar.gz snac2-405bf6b8e4241252ed7bde917a21e0c57d4bab70.tar.xz snac2-405bf6b8e4241252ed7bde917a21e0c57d4bab70.zip | |
Maintain a one-element index with each entry's parent.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 12 |
1 files changed, 8 insertions, 4 deletions
| @@ -454,12 +454,16 @@ int _object_add(const char *id, d_char *obj, int ow) | |||
| 454 | 454 | ||
| 455 | if (!xs_is_null(in_reply_to) && *in_reply_to) { | 455 | if (!xs_is_null(in_reply_to) && *in_reply_to) { |
| 456 | /* update the children index of the parent */ | 456 | /* update the children index of the parent */ |
| 457 | xs *pfn = _object_fn(in_reply_to); | 457 | xs *c_idx = _object_fn(in_reply_to); |
| 458 | 458 | ||
| 459 | pfn = xs_replace_i(pfn, ".json", "_c.idx"); | 459 | c_idx = xs_replace_i(c_idx, ".json", "_c.idx"); |
| 460 | index_add(pfn, id); | 460 | index_add(c_idx, id); |
| 461 | 461 | ||
| 462 | srv_debug(0, xs_fmt("object_add added child %s to %s", id, pfn)); | 462 | srv_debug(0, xs_fmt("object_add added child %s to %s", id, c_idx)); |
| 463 | |||
| 464 | /* create a one-element index with the parent */ | ||
| 465 | xs *p_idx = xs_replace(fn, ".json", "_p.idx"); | ||
| 466 | index_add(p_idx, in_reply_to); | ||
| 463 | } | 467 | } |
| 464 | } | 468 | } |
| 465 | else | 469 | else |