commit 405bf6b
default
·
2022-11-26 04:29:09 +0000 UTC
parent 1243e26
Maintain a one-element index with each entry's parent.
1 files changed,
+8,
-4
M
data.c
M
data.c
+8,
-4
1@@ -454,12 +454,16 @@ int _object_add(const char *id, d_char *obj, int ow)
2
3 if (!xs_is_null(in_reply_to) && *in_reply_to) {
4 /* update the children index of the parent */
5- xs *pfn = _object_fn(in_reply_to);
6+ xs *c_idx = _object_fn(in_reply_to);
7
8- pfn = xs_replace_i(pfn, ".json", "_c.idx");
9- index_add(pfn, id);
10+ c_idx = xs_replace_i(c_idx, ".json", "_c.idx");
11+ index_add(c_idx, id);
12
13- srv_debug(0, xs_fmt("object_add added child %s to %s", id, pfn));
14+ srv_debug(0, xs_fmt("object_add added child %s to %s", id, c_idx));
15+
16+ /* create a one-element index with the parent */
17+ xs *p_idx = xs_replace(fn, ".json", "_p.idx");
18+ index_add(p_idx, in_reply_to);
19 }
20 }
21 else