@dxos/index-core 0.8.4-main.2244d791bb → 0.8.4-main.3fbcb4aa9b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  // src/index-engine.ts
2
2
  import * as Effect5 from "effect/Effect";
3
+ import { ATTR_TYPE as ATTR_TYPE2 } from "@dxos/echo/internal";
3
4
  import * as SqlTransaction from "@dxos/sql-sqlite/SqlTransaction";
4
5
 
5
6
  // src/index-tracker.ts
@@ -31,6 +32,9 @@ var IndexCursor = Schema.Struct({
31
32
  */
32
33
  cursor: Schema.Union(Schema.Number, Schema.String)
33
34
  });
35
+ var DEPRECATED_INDEX_NAMES = [
36
+ "fts"
37
+ ];
34
38
  var IndexTracker = class {
35
39
  migrate = Effect.fn("IndexTracker.migrate")(function* () {
36
40
  const sql = yield* SqlClient.SqlClient;
@@ -42,6 +46,9 @@ var IndexTracker = class {
42
46
  cursor,
43
47
  PRIMARY KEY (indexName, spaceId, sourceName, resourceId)
44
48
  )`;
49
+ yield* Effect.forEach(DEPRECATED_INDEX_NAMES, (indexName) => {
50
+ return sql`DELETE FROM indexCursor WHERE indexName = ${indexName}`;
51
+ });
45
52
  });
46
53
  queryCursors = Effect.fn("IndexTracker.queryCursors")((query) => Effect.gen(function* () {
47
54
  const sql = yield* SqlClient.SqlClient;
@@ -82,6 +89,7 @@ var IndexTracker = class {
82
89
  // src/indexes/fts-index.ts
83
90
  import * as SqlClient3 from "@effect/sql/SqlClient";
84
91
  import * as Effect2 from "effect/Effect";
92
+ var SQL_CHUNK_SIZE = 500;
85
93
  var escapeFts5Query = (text) => {
86
94
  return text.split(/\s+/).filter(Boolean).map((term) => `"${term.replace(/"/g, '""')}"`).join(" ");
87
95
  };
@@ -143,6 +151,7 @@ var FtsIndex = class {
143
151
  /**
144
152
  * Query snapshots by recordIds.
145
153
  * Returns the parsed JSON snapshots for queue objects.
154
+ * RecordIds not present in the FTS index are silently omitted from the result.
146
155
  */
147
156
  querySnapshotsJSON(recordIds) {
148
157
  return Effect2.gen(function* () {
@@ -150,11 +159,21 @@ var FtsIndex = class {
150
159
  return [];
151
160
  }
152
161
  const sql = yield* SqlClient3.SqlClient;
153
- const results = yield* sql`SELECT rowid, snapshot FROM ftsIndex WHERE rowid IN ${sql.in(recordIds)}`;
154
- return results.map((r) => ({
155
- recordId: r.rowid,
156
- snapshot: JSON.parse(r.snapshot)
157
- }));
162
+ const chunks = [];
163
+ for (let i = 0; i < recordIds.length; i += SQL_CHUNK_SIZE) {
164
+ chunks.push(recordIds.slice(i, i + SQL_CHUNK_SIZE));
165
+ }
166
+ const allResults = [];
167
+ for (const chunk of chunks) {
168
+ const rows = yield* sql`SELECT rowid, snapshot FROM ftsIndex WHERE rowid IN ${sql.in(chunk)}`;
169
+ for (const r of rows) {
170
+ allResults.push({
171
+ recordId: r.rowid,
172
+ snapshot: JSON.parse(r.snapshot)
173
+ });
174
+ }
175
+ }
176
+ return allResults;
158
177
  });
159
178
  }
160
179
  update = Effect2.fn("FtsIndex.update")((objects) => Effect2.gen(function* () {
@@ -190,6 +209,8 @@ var ObjectMeta = Schema2.Struct({
190
209
  recordId: Schema2.Number,
191
210
  objectId: Schema2.String,
192
211
  queueId: Schema2.String,
212
+ /** Queue subspace namespace (e.g. 'data', 'trace'). Empty string for non-queue objects. */
213
+ queueNamespace: Schema2.String,
193
214
  spaceId: Schema2.String,
194
215
  documentId: Schema2.String,
195
216
  entityKind: Schema2.String,
@@ -201,8 +222,29 @@ var ObjectMeta = Schema2.Struct({
201
222
  /** Parent object id (nullable). */
202
223
  parent: Schema2.NullOr(Schema2.String),
203
224
  /** Monotonically increasing sequence number assigned on insert/update for tracking indexing order. */
204
- version: Schema2.Number
225
+ version: Schema2.Number,
226
+ /** Unix ms timestamp when the object was first indexed. */
227
+ createdAt: Schema2.NullOr(Schema2.Number),
228
+ /** Unix ms timestamp when the object was last re-indexed. */
229
+ updatedAt: Schema2.NullOr(Schema2.Number)
205
230
  });
231
+ var buildSourceCondition = (sql, spaceIds, includeAllQueues, queueIds) => {
232
+ const conditions = [];
233
+ if (spaceIds.length > 0) {
234
+ if (includeAllQueues) {
235
+ conditions.push(sql`${sql.in("spaceId", spaceIds)}`);
236
+ } else {
237
+ conditions.push(sql`(${sql.in("spaceId", spaceIds)} AND queueId = '')`);
238
+ }
239
+ }
240
+ if (queueIds && queueIds.length > 0) {
241
+ conditions.push(sql`${sql.in("queueId", queueIds)}`);
242
+ }
243
+ if (conditions.length === 0) {
244
+ return sql`1 = 0`;
245
+ }
246
+ return sql.or(conditions);
247
+ };
206
248
  var ObjectMetaIndex = class {
207
249
  migrate = Effect3.fn("ObjectMetaIndex.runMigrations")(function* () {
208
250
  const sql = yield* SqlClient5.SqlClient;
@@ -210,6 +252,7 @@ var ObjectMetaIndex = class {
210
252
  recordId INTEGER PRIMARY KEY AUTOINCREMENT,
211
253
  objectId TEXT NOT NULL,
212
254
  queueId TEXT NOT NULL DEFAULT '',
255
+ queueNamespace TEXT NOT NULL DEFAULT '',
213
256
  spaceId TEXT NOT NULL,
214
257
  documentId TEXT NOT NULL DEFAULT '',
215
258
  entityKind TEXT NOT NULL,
@@ -218,13 +261,20 @@ var ObjectMetaIndex = class {
218
261
  source TEXT,
219
262
  target TEXT,
220
263
  parent TEXT,
221
- version INTEGER NOT NULL
264
+ version INTEGER NOT NULL,
265
+ createdAt INTEGER,
266
+ updatedAt INTEGER
222
267
  )`;
223
268
  yield* Effect3.catchAll(sql`ALTER TABLE objectMeta ADD COLUMN parent TEXT`, () => Effect3.void);
269
+ yield* Effect3.catchAll(sql`ALTER TABLE objectMeta ADD COLUMN createdAt INTEGER`, () => Effect3.void);
270
+ yield* Effect3.catchAll(sql`ALTER TABLE objectMeta ADD COLUMN updatedAt INTEGER`, () => Effect3.void);
271
+ yield* Effect3.catchAll(sql`ALTER TABLE objectMeta ADD COLUMN queueNamespace TEXT NOT NULL DEFAULT ''`, () => Effect3.void);
224
272
  yield* sql`CREATE INDEX IF NOT EXISTS idx_object_index_objectId ON objectMeta(spaceId, objectId)`;
225
273
  yield* sql`CREATE INDEX IF NOT EXISTS idx_object_index_typeDxn ON objectMeta(spaceId, typeDxn)`;
226
274
  yield* sql`CREATE INDEX IF NOT EXISTS idx_object_index_version ON objectMeta(version)`;
227
275
  yield* sql`CREATE INDEX IF NOT EXISTS idx_object_index_parent ON objectMeta(spaceId, parent)`;
276
+ yield* sql`CREATE INDEX IF NOT EXISTS idx_object_index_updatedAt ON objectMeta(updatedAt)`;
277
+ yield* sql`CREATE INDEX IF NOT EXISTS idx_object_index_createdAt ON objectMeta(createdAt)`;
228
278
  });
229
279
  query = Effect3.fn("ObjectMetaIndex.query")((query) => Effect3.gen(function* () {
230
280
  const sql = yield* SqlClient5.SqlClient;
@@ -236,18 +286,19 @@ var ObjectMetaIndex = class {
236
286
  }));
237
287
  }));
238
288
  queryAll = Effect3.fn("ObjectMetaIndex.queryAll")((query) => Effect3.gen(function* () {
239
- if (query.spaceIds.length === 0) {
289
+ if (query.spaceIds.length === 0 && (!query.queueIds || query.queueIds.length === 0)) {
240
290
  return [];
241
291
  }
242
292
  const sql = yield* SqlClient5.SqlClient;
243
- const rows = yield* sql`SELECT * FROM objectMeta WHERE ${sql.in("spaceId", query.spaceIds)}`;
293
+ const sourceCondition = buildSourceCondition(sql, query.spaceIds, query.includeAllQueues ?? false, query.queueIds ?? null);
294
+ const rows = yield* sql`SELECT * FROM objectMeta WHERE ${sourceCondition}`;
244
295
  return rows.map((row) => ({
245
296
  ...row,
246
297
  deleted: !!row.deleted
247
298
  }));
248
299
  }));
249
- queryTypes = Effect3.fn("ObjectMetaIndex.queryTypes")(({ spaceIds, typeDxns, inverted = false }) => Effect3.gen(function* () {
250
- if (spaceIds.length === 0) {
300
+ queryTypes = Effect3.fn("ObjectMetaIndex.queryTypes")(({ spaceIds, typeDxns, inverted = false, includeAllQueues = false, queueIds = null }) => Effect3.gen(function* () {
301
+ if (spaceIds.length === 0 && (!queueIds || queueIds.length === 0)) {
251
302
  return [];
252
303
  }
253
304
  if (typeDxns.length === 0) {
@@ -255,14 +306,15 @@ var ObjectMetaIndex = class {
255
306
  return [];
256
307
  }
257
308
  const sql2 = yield* SqlClient5.SqlClient;
258
- const rows2 = yield* sql2`SELECT * FROM objectMeta WHERE ${sql2.in("spaceId", spaceIds)}`;
309
+ const sourceCondition2 = buildSourceCondition(sql2, spaceIds, includeAllQueues, queueIds);
310
+ const rows2 = yield* sql2`SELECT * FROM objectMeta WHERE ${sourceCondition2}`;
259
311
  return rows2.map((row) => ({
260
312
  ...row,
261
313
  deleted: !!row.deleted
262
314
  }));
263
315
  }
264
316
  const sql = yield* SqlClient5.SqlClient;
265
- const spaceWhere = sql.in("spaceId", spaceIds);
317
+ const sourceCondition = buildSourceCondition(sql, spaceIds, includeAllQueues, queueIds);
266
318
  const typeWhere = sql.or(typeDxns.map((typeDxn) => {
267
319
  const parsedType = DXN.tryParse(typeDxn)?.asTypeDXN();
268
320
  return parsedType && parsedType.version === void 0 ? sql.or([
@@ -270,7 +322,7 @@ var ObjectMetaIndex = class {
270
322
  sql`typeDxn LIKE ${_escapeLikePrefix(typeDxn)} ESCAPE '\\'`
271
323
  ]) : sql`typeDxn = ${typeDxn}`;
272
324
  }));
273
- const rows = inverted ? yield* sql`SELECT * FROM objectMeta WHERE ${spaceWhere} AND NOT ${typeWhere}` : yield* sql`SELECT * FROM objectMeta WHERE ${spaceWhere} AND ${typeWhere}`;
325
+ const rows = inverted ? yield* sql`SELECT * FROM objectMeta WHERE ${sourceCondition} AND NOT ${typeWhere}` : yield* sql`SELECT * FROM objectMeta WHERE ${sourceCondition} AND ${typeWhere}`;
274
326
  return rows.map((row) => ({
275
327
  ...row,
276
328
  deleted: !!row.deleted
@@ -292,7 +344,7 @@ var ObjectMetaIndex = class {
292
344
  update = Effect3.fn("ObjectMetaIndex.update")((objects) => Effect3.gen(function* () {
293
345
  const sql = yield* SqlClient5.SqlClient;
294
346
  yield* Effect3.forEach(objects, (object) => Effect3.gen(function* () {
295
- const { spaceId, queueId, documentId, data } = object;
347
+ const { spaceId, queueId, queueNamespace, documentId, data } = object;
296
348
  const castData = data;
297
349
  const objectId = castData.id;
298
350
  let existing;
@@ -312,27 +364,32 @@ var ObjectMetaIndex = class {
312
364
  const source = entityKind === "relation" ? castData[ATTR_RELATION_SOURCE] ?? null : null;
313
365
  const target = entityKind === "relation" ? castData[ATTR_RELATION_TARGET] ?? null : null;
314
366
  const parent = castData[ATTR_PARENT] ?? null;
367
+ const sourceTimestamp = object.updatedAt;
315
368
  if (existing.length > 0) {
316
369
  yield* sql`
317
370
  UPDATE objectMeta SET
318
371
  version = ${version},
372
+ queueNamespace = ${queueNamespace ?? ""},
319
373
  entityKind = ${entityKind},
320
374
  typeDxn = ${typeDxn},
321
375
  deleted = ${deleted},
322
376
  source = ${source},
323
377
  target = ${target},
324
- parent = ${parent}
378
+ parent = ${parent},
379
+ updatedAt = ${sourceTimestamp}
325
380
  WHERE recordId = ${existing[0].recordId}
326
381
  `;
327
382
  } else {
328
383
  yield* sql`
329
384
  INSERT INTO objectMeta (
330
- objectId, queueId, spaceId, documentId,
331
- entityKind, typeDxn, deleted, source, target, parent, version
385
+ objectId, queueId, queueNamespace, spaceId, documentId,
386
+ entityKind, typeDxn, deleted, source, target, parent, version,
387
+ createdAt, updatedAt
332
388
  ) VALUES (
333
- ${objectId}, ${queueId ?? ""}, ${spaceId}, ${documentId ?? ""},
334
- ${entityKind}, ${typeDxn}, ${deleted},
335
- ${source}, ${target}, ${parent}, ${version}
389
+ ${objectId}, ${queueId ?? ""}, ${queueNamespace ?? ""}, ${spaceId}, ${documentId ?? ""},
390
+ ${entityKind}, ${typeDxn}, ${deleted},
391
+ ${source}, ${target}, ${parent}, ${version},
392
+ ${sourceTimestamp}, ${sourceTimestamp}
336
393
  )
337
394
  `;
338
395
  }
@@ -378,14 +435,61 @@ var ObjectMetaIndex = class {
378
435
  }));
379
436
  }));
380
437
  /**
438
+ * Look up object metadata by objectId, spaceId, and queueId.
439
+ */
440
+ lookupByObjectId = Effect3.fn("ObjectMetaIndex.lookupByObjectId")((query) => Effect3.gen(function* () {
441
+ const sql = yield* SqlClient5.SqlClient;
442
+ const rows = yield* sql`SELECT * FROM objectMeta WHERE spaceId = ${query.spaceId} AND queueId = ${query.queueId} AND objectId = ${query.objectId} LIMIT 1`;
443
+ if (rows.length === 0) {
444
+ return null;
445
+ }
446
+ return {
447
+ ...rows[0],
448
+ deleted: !!rows[0].deleted
449
+ };
450
+ }));
451
+ /**
452
+ * Query objects by timestamp range.
453
+ */
454
+ queryByTimeRange = Effect3.fn("ObjectMetaIndex.queryByTimeRange")((query) => Effect3.gen(function* () {
455
+ if (query.spaceIds.length === 0 && (!query.queueIds || query.queueIds.length === 0)) {
456
+ return [];
457
+ }
458
+ const sql = yield* SqlClient5.SqlClient;
459
+ const sourceCondition = buildSourceCondition(sql, query.spaceIds, query.includeAllQueues ?? false, query.queueIds ?? null);
460
+ const timeConditions = [];
461
+ if (query.updatedAfter != null) {
462
+ timeConditions.push(sql`updatedAt >= ${query.updatedAfter}`);
463
+ }
464
+ if (query.updatedBefore != null) {
465
+ timeConditions.push(sql`updatedAt <= ${query.updatedBefore}`);
466
+ }
467
+ if (query.createdAfter != null) {
468
+ timeConditions.push(sql`createdAt >= ${query.createdAfter}`);
469
+ }
470
+ if (query.createdBefore != null) {
471
+ timeConditions.push(sql`createdAt <= ${query.createdBefore}`);
472
+ }
473
+ const rows = timeConditions.length > 0 ? yield* sql`SELECT * FROM objectMeta WHERE ${sourceCondition} AND ${sql.and(timeConditions)}` : yield* sql`SELECT * FROM objectMeta WHERE ${sourceCondition}`;
474
+ return rows.map((row) => ({
475
+ ...row,
476
+ deleted: !!row.deleted
477
+ }));
478
+ }));
479
+ /**
381
480
  * Query children by parent object ids.
481
+ * Matches both:
482
+ * - Objects whose `parent` field references one of the given parent ids (standard parent/child hierarchy).
483
+ * - Queue items whose `queueId` equals one of the parent ids (e.g. items inside a Feed, since a feed's queue
484
+ * DXN uses the feed's object id as its queue id — see `Feed.getQueueDxn`).
382
485
  */
383
486
  queryChildren = Effect3.fn("ObjectMetaIndex.queryChildren")((query) => Effect3.gen(function* () {
384
487
  if (query.parentIds.length === 0) {
385
488
  return [];
386
489
  }
387
490
  const sql = yield* SqlClient5.SqlClient;
388
- const rows = yield* sql`SELECT * FROM objectMeta WHERE spaceId IN ${sql.in(query.spaceId)} AND parent IN ${sql.in(query.parentIds.map((id) => DXN.fromLocalObjectId(id).toString()))}`;
491
+ const parentDxns = query.parentIds.map((id) => DXN.fromLocalObjectId(id).toString());
492
+ const rows = yield* sql`SELECT * FROM objectMeta WHERE ${sql.in("spaceId", query.spaceId)} AND (${sql.in("parent", parentDxns)} OR ${sql.in("queueId", query.parentIds)})`;
389
493
  return rows.map((row) => ({
390
494
  ...row,
391
495
  deleted: !!row.deleted
@@ -414,15 +518,7 @@ var EscapedPropPath = class extends Schema3.String.annotations({
414
518
  let current = "";
415
519
  for (let i = 0; i < path.length; i++) {
416
520
  if (path[i] === "\\") {
417
- invariant(i + 1 < path.length && (path[i + 1] === "." || path[i + 1] === "\\"), "Malformed escaping.", {
418
- F: __dxlog_file,
419
- L: 34,
420
- S: this,
421
- A: [
422
- "i + 1 < path.length && (path[i + 1] === '.' || path[i + 1] === '\\\\')",
423
- "'Malformed escaping.'"
424
- ]
425
- });
521
+ invariant(i + 1 < path.length && (path[i + 1] === "." || path[i + 1] === "\\"), "Malformed escaping.", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 25, S: this, A: ["i + 1 < path.length && (path[i + 1] === '.' || path[i + 1] === '\\\\')", "'Malformed escaping.'"] });
426
522
  current = current + path[i + 1];
427
523
  i++;
428
524
  } else if (path[i] === ".") {
@@ -522,6 +618,33 @@ var ReverseRefIndex = class {
522
618
  };
523
619
 
524
620
  // src/index-engine.ts
621
+ var makeEmptyIndexingResult = () => ({
622
+ updated: 0,
623
+ done: true,
624
+ spaces: /* @__PURE__ */ new Set(),
625
+ queues: /* @__PURE__ */ new Set(),
626
+ documents: /* @__PURE__ */ new Set(),
627
+ types: /* @__PURE__ */ new Set(),
628
+ objects: /* @__PURE__ */ new Set()
629
+ });
630
+ var accumulateIndexingResult = (acc, objects) => {
631
+ for (const obj of objects) {
632
+ acc.spaces.add(obj.spaceId);
633
+ if (obj.queueId) {
634
+ acc.queues.add(obj.queueId);
635
+ }
636
+ if (obj.documentId) {
637
+ acc.documents.add(obj.documentId);
638
+ }
639
+ const t = obj.data[ATTR_TYPE2];
640
+ if (t) {
641
+ acc.types.add(String(t));
642
+ }
643
+ if (obj.data.id) {
644
+ acc.objects.add(obj.data.id);
645
+ }
646
+ }
647
+ };
525
648
  var IndexEngine = class {
526
649
  #tracker;
527
650
  #objectMetaIndex;
@@ -574,31 +697,38 @@ var IndexEngine = class {
574
697
  queryTypes(query) {
575
698
  return this.#objectMetaIndex.queryTypes(query);
576
699
  }
700
+ queryByTimeRange(query) {
701
+ return this.#objectMetaIndex.queryByTimeRange(query);
702
+ }
577
703
  queryRelations(query) {
578
704
  return this.#objectMetaIndex.queryRelations(query);
579
705
  }
580
706
  lookupByRecordIds(recordIds) {
581
707
  return this.#objectMetaIndex.lookupByRecordIds(recordIds);
582
708
  }
583
- update(dataSource, opts) {
709
+ lookupByObjectId(query) {
710
+ return this.#objectMetaIndex.lookupByObjectId(query);
711
+ }
712
+ update(ctx, dataSource, opts) {
584
713
  return Effect5.gen(this, function* () {
585
- let updated = 0;
586
- const { updated: updatedFtsIndex, done: doneFtsIndex } = yield* this.#update(this.#ftsIndex, dataSource, {
587
- indexName: "fts",
714
+ const result = makeEmptyIndexingResult();
715
+ const { updated: updatedFtsIndex, done: doneFtsIndex, objects: ftsObjects } = yield* this.#update(ctx, this.#ftsIndex, dataSource, {
716
+ indexName: "fts5",
588
717
  spaceId: opts.spaceId,
589
718
  limit: opts.limit
590
719
  });
591
- updated += updatedFtsIndex;
592
- const { updated: updatedReverseRefIndex, done: doneReverseRefIndex } = yield* this.#update(this.#reverseRefIndex, dataSource, {
720
+ result.updated += updatedFtsIndex;
721
+ result.done = result.done && doneFtsIndex;
722
+ accumulateIndexingResult(result, ftsObjects);
723
+ const { updated: updatedReverseRefIndex, done: doneReverseRefIndex, objects: reverseRefObjects } = yield* this.#update(ctx, this.#reverseRefIndex, dataSource, {
593
724
  indexName: "reverseRef",
594
725
  spaceId: opts.spaceId,
595
726
  limit: opts.limit
596
727
  });
597
- updated += updatedReverseRefIndex;
598
- return {
599
- updated,
600
- done: doneFtsIndex && doneReverseRefIndex
601
- };
728
+ result.updated += updatedReverseRefIndex;
729
+ result.done = result.done && doneReverseRefIndex;
730
+ accumulateIndexingResult(result, reverseRefObjects);
731
+ return result;
602
732
  }).pipe(Effect5.withSpan("IndexEngine.update"));
603
733
  }
604
734
  /**
@@ -610,7 +740,7 @@ var IndexEngine = class {
610
740
  * 4. Enriches objects with recordIds.
611
741
  * 5. Updates the dependent index.
612
742
  */
613
- #update(index, source, opts) {
743
+ #update(ctx, index, source, opts) {
614
744
  return Effect5.gen(this, function* () {
615
745
  const sqlTransaction = yield* SqlTransaction.SqlTransaction;
616
746
  return yield* sqlTransaction.withTransaction(Effect5.gen(this, function* () {
@@ -620,13 +750,14 @@ var IndexEngine = class {
620
750
  // Pass undefined to get all cursors when spaceId is null.
621
751
  spaceId: opts.spaceId ?? void 0
622
752
  });
623
- const { objects, cursors: updatedCursors } = yield* source.getChangedObjects(cursors, {
753
+ const { objects, cursors: updatedCursors } = yield* source.getChangedObjects(ctx, cursors, {
624
754
  limit: opts.limit
625
755
  });
626
756
  if (objects.length === 0) {
627
757
  return {
628
758
  updated: 0,
629
- done: true
759
+ done: true,
760
+ objects: []
630
761
  };
631
762
  }
632
763
  yield* this.#objectMetaIndex.update(objects);
@@ -641,7 +772,8 @@ var IndexEngine = class {
641
772
  })));
642
773
  return {
643
774
  updated: objects.length,
644
- done: false
775
+ done: false,
776
+ objects
645
777
  };
646
778
  }));
647
779
  }).pipe(Effect5.withSpan("IndexEngine.#update"));