Skip to content

FULL_TEXT index returns no result when database is encrypted #5142

Closed

Description

@koljakube

I do not yet have a minimal reproduction of the issue, but I reported (via Discord) a similar bug a few weeks ago, so maybe this is enough for you to take a look.

In my (proprietary, complex) code base I can reproduce the problem by simply commenting out my setDataEncryption() call, so I'm pretty sure that is the cause of the problem.

I have a (document) type defined in the database, that has a field of type String (mandatory, non-nullable). The index is defined like this:

                documentType.schema
                    .buildTypeIndex(typeName, arrayOf(propName))
                    .withType(FULL_TEXT)
                    .withFullTextType()
                    .withBM25(1.2f, 0.75f)
                    .withUnique(false)
                    .withNullStrategy(LSMTreeIndexAbstract.NULL_STRATEGY.SKIP)
                    .create()

When I insert a record with the indexed property set to Hello World, and try to retrieve it with this: SELECT FROM Entry WHERE SEARCH_FIELDS(['payload'], 'hello'); I get results with disabled encryption, and a LocalResultSet(hasNext=false) with enabled encryption.

Activity

  1. self-assigned this
    on Jul 8, 2026
  2. added a commit that references this issue on Jul 8, 2026
  3. added this to the 26.7.2 milestone on Jul 8, 2026
  4. added theissue type on Jul 8, 2026
  5. lvca commented on Jul 8, 2026

    @lvca
    Member

    Confirmed and fixed in main (commit cfa4257), shipping in 26.7.2.

    Cause: encryption uses a fresh random value on every write, so the same word gets stored differently each time. FULL_TEXT (and all LSM-tree) indexes look keys up by exact match, so the lookup never matched what was stored and you got an empty result. The fix stores index keys unencrypted while keeping your record data encrypted, the same way HASH indexes already worked. This affected every FULL_TEXT and standard index on an encrypted database, not just full-text.

    Note: if you have an existing encrypted database created before this fix, run REBUILD INDEX * once after upgrading so the affected indexes are rewritten in the new format. New databases need no action.

    Thanks for the clear report!

  6. added a commit that references this issue on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions