Skip to content

Declare the content id indexes on the model - #80

Merged
jasperblues merged 1 commit into
mainfrom
content-id-index-on-model
Nov 16, 2026
Merged

jasperblues merged 1 commit into
mainfrom
content-id-index-on-model

Conversation

@jasperblues

Copy link
Copy Markdown
Collaborator

Follow-up to #78.

What changed

#78 added range indexes on ContentElement(id) and Chunk(id), listed by hand in GraphObjectManagerStore.provision(). They now sit beside the @NodeId they serve:

  • ContentElementFragment and ChunkPlaceFragment declare @NodeId @RangeIndex val id.
  • provision() reads the range indexes off those two fragments (CONTENT_ID_FRAGMENTS) with SchemaCatalog.fromFragments(...), instead of a hand-written list. The indexes provisioned are the same as before.
  • GraphProvisioner is unchanged: convention names for vector and full-text indexes, and no renaming of an existing range index.

The chunk label comes from the fragment annotation (Chunk). That equals properties.chunkNodeName, because the store's init already refuses any other chunk label.

Why

Every save finds its node by the fragment's @NodeId, so the index belongs on the model, next to it. With the model as the one source of the index, a new content fragment can't leave its saves unindexed without a test failing.

Tests

New ContentIdIndexesFollowTheModelTest (no database):

  • the indexes derived from the model equal the old hand list;
  • every @NodeFragment in the model package that is labelled ContentElement or Chunk has its @NodeId served by a declared index;
  • the check catches a fragment whose @NodeId has no @RangeIndex (the two fragments with no indexes, and a test fragment found by another property).

mvn clean install: 494 tests in 78 classes, 0 failures, 0 errors, 0 skipped (counted from the surefire XML). That includes both Neo4jContentElementIdIndexTest cases and the 3 new tests.

The range indexes on ContentElement(id) and Chunk(id) that #78 added were
listed by hand in GraphObjectManagerStore.provision(). They now sit beside
the @nodeid they serve, as @nodeid @RangeIndex on ContentElementFragment
and ChunkPlaceFragment, and provision() reads them off those fragments
with SchemaCatalog.fromFragments. The indexes provisioned are the same.

ContentIdIndexesFollowTheModelTest checks that the derived list equals the
old hand list, and scans every @NodeFragment in the model package: any
fragment labelled ContentElement or Chunk whose @nodeid no declared index
serves fails the test, so a new fragment can't leave its saves unindexed.
@jasperblues
jasperblues merged commit c9a531b into main Nov 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant