Repository navigation
Description
Description
Two related failures on the FULL_TEXT bulk-build path, both reproduced on a single-property index:
-
CREATE INDEX ... FULL_TEXTover a type that already has rows reports the rows as indexed (totalIndexed:N) but they never match. Only documents inserted after the index is created are returned bySEARCH_INDEX. So the common "load data, then add a full-text index" flow yields a silently empty index for all pre-existing rows. -
REBUILD INDEX <fulltext-index>crashes and leaves the index dropped. The obvious recovery for (1) - rebuild the index from the documents - fails withA FULL_TEXT index requires FullTextIndexMetadata but got com.arcadedb.schema.IndexMetadata, and afterward the index no longer exists (Index with name '...' was not found). TheWITH statsOnly = truevariant (BM25 corpus-counter repair) works correctly; only the full reindex crashes.
Together these mean a FULL_TEXT index cannot be correctly built or repaired over data that already exists: the create path indexes nothing matchable, and the reindex path destroys the index.
Environment
- ArcadeDB Server
26.7.1-SNAPSHOT(build661e52fce3b84f452f02cc131b9c5608674deb67/1782276736394/main) - Default database options
- Reproduced with the default similarity (BM25). The build path is shared with CLASSIC; see the related multi-property report for a CLASSIC repro of the build path crashing.
Root cause
Suspected, two areas:
-
Build-over-existing (CREATE): the type-scan build that populates a new index from existing records appears not to route those records through the same analyze-and-store path used by live
put()(or stores them in a formSEARCH_INDEXdoes not look up).totalIndexedis reported from the scan count, so it reads as success while no matchable postings were written. The liveput()path (engine/.../index/fulltext/LSMTreeFullTextIndex.java#put/putWithStats) is known-good because create-then-insert works; the divergence is in the initial build/scan. -
REBUILD: the rebuild path fetches the index's metadata as a base
IndexMetadataand then requires aFullTextIndexMetadata, throwing on the type mismatch (A FULL_TEXT index requires FullTextIndexMetadata but got com.arcadedb.schema.IndexMetadata). The full-text metadata round-trip was reworked in PR feat: [#4687] native BM25 full-text scoring (field boosts, caret, EXPLAIN/PROFILE) #4695; the rebuild entry point likely reconstructs a genericIndexMetadatainstead of the full-text subtype, and the failure occurs after the old index has already been removed, so the index is left dropped.
Steps to reproduce
# --- (1) build over existing data does not match ---
curl -sS -u root:playwithdata http://localhost:2480/api/v1/command/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"CREATE DOCUMENT TYPE doc"}'
curl -sS -u root:playwithdata http://localhost:2480/api/v1/command/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"CREATE PROPERTY doc.title STRING"}'
curl -sS -u root:playwithdata http://localhost:2480/api/v1/command/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"INSERT INTO doc SET title = '"'"'java database tutorial'"'"'"}'
curl -sS -u root:playwithdata http://localhost:2480/api/v1/command/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"CREATE INDEX ON doc (title) FULL_TEXT"}'
# -> created, "totalIndexed":1
curl -sS -u root:playwithdata http://localhost:2480/api/v1/query/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"SELECT title FROM doc WHERE SEARCH_INDEX('"'"'doc[title]'"'"', '"'"'java'"'"') = true"}'
# -> [] (the pre-existing row is NOT matched)
# a row inserted AFTER index creation matches fine:
curl -sS -u root:playwithdata http://localhost:2480/api/v1/command/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"INSERT INTO doc SET title = '"'"'another java doc'"'"'"}'
curl -sS -u root:playwithdata http://localhost:2480/api/v1/query/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"SELECT title FROM doc WHERE SEARCH_INDEX('"'"'doc[title]'"'"', '"'"'java'"'"') = true"}'
# -> only "another java doc"; the pre-existing "java database tutorial" still missing
# --- (2) REBUILD crashes and drops the index ---
curl -sS -u root:playwithdata http://localhost:2480/api/v1/command/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"REBUILD INDEX `doc[title]`"}'
# -> IndexException: Error on rebuilding index 'doc[title]'
# (error=A FULL_TEXT index requires FullTextIndexMetadata but got com.arcadedb.schema.IndexMetadata)
curl -sS -u root:playwithdata http://localhost:2480/api/v1/query/test \
-H 'Content-Type: application/json' \
-d '{"language":"sql","command":"SELECT title FROM doc WHERE SEARCH_INDEX('"'"'doc[title]'"'"', '"'"'java'"'"') = true"}'
# -> SchemaException: Index with name 'doc[title]' was not found (index is gone)
# contrast: statsOnly rebuild works on a valid (create-then-insert) index
# REBUILD INDEX `doc[title]` WITH statsOnly = true -> {"operation":"rebuild index stats","statsRecomputed":N}Observed
CREATE INDEX ON doc (title) FULL_TEXTover a populated type reports"totalIndexed":1butSEARCH_INDEXreturns no pre-existing rows; only post-create inserts match.REBUILD INDEX <fulltext>throwsA FULL_TEXT index requires FullTextIndexMetadata but got com.arcadedb.schema.IndexMetadataand the index is dropped (subsequentSEARCH_INDEX->Index ... was not found).REBUILD INDEX <fulltext> WITH statsOnly = truesucceeds.
Expected
- Creating a FULL_TEXT index over existing data indexes those rows so they are immediately matchable by
SEARCH_INDEX(consistent with the reportedtotalIndexedcount). REBUILD INDEX <fulltext>re-analyzes the documents and rebuilds postings without crashing, and never leaves the index dropped on failure (rebuild should be atomic: keep the old index until the new one is built).
Suggested fix
- Build path: route the initial type-scan build through the same analyze-and-store logic as live
put()/putWithStatsso the postings written during build are identical to those written incrementally (and therefore found bySEARCH_INDEX). - REBUILD path: when reconstructing the index during rebuild, preserve the
FullTextIndexMetadatasubtype (build it from the persisted full-text configuration) instead of a genericIndexMetadata. Make rebuild atomic so a failure does not delete the existing index.
Activity
fix: [#4732] REBUILD INDEX on a FULL_TEXT index no longer crashes and…
lvca commentedon Jun 24, 2026
Fixed
fix(#5791): REBUILD INDEX preserves an explicitly-named FULL_TEXT/GEO…
fix: [#4732] REBUILD INDEX on a FULL_TEXT index no longer crashes and…
fix(lore): деприцированный слайс search падал 502 на повреждённом FT-…