Skip to content

sync_bm25_index_to stores compact @id document keys #2244

Open

Description

@bplatz

Problem

create_full_text_index, sync_bm25_index and resync_bm25_index expand each result's @id to a full IRI (extract_prefix_map + expand_ids_in_results) before touching the index, so a document has one key whichever path wrote it. sync_bm25_index_to doesn't: it passes the results of execute_bm25_indexing_query_historical straight to Bm25IndexBuilder::add_results. With "@context": {"ex": "http://example.org/"} in the indexing query, a snapshot built by sync_bm25_index_to keys a document as ex:c rather than http://example.org/c.

Effect

  • Lookups by full IRI miss that snapshot's documents, and its search results use the compact form.
  • When that snapshot is the head, the next incremental sync matches the subjects it affects by full IRI. It should then write full-IRI keys next to the compact ones, leaving one index with both spellings until a full resync. That is the problem the comment above expand_ids_in_results in the incremental path describes. This consequence is read from the code; it hasn't been reproduced.

Fix

Expand the ids in sync_bm25_index_to as the other paths do, and pin it with a test that reads the document keys after a sync to a t.

Activity

  1. added
    bug
    P3
    area:query
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area:querybugfull text search

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions