Skip to content

FalkorDB fulltext query fails on a lone _ token #2142

Open

Description

@JaMa1995

Bug: FalkorDB fulltext query fails on a lone _ token

Version: graphiti-core 0.31.2, FalkorDB driver

sanitize_falkor_fulltext_query (graphiti_core/driver/falkordb/fulltext.py) replaces separator characters with spaces but keeps _. Inputs such as name _ date or name (_) date therefore yield a token that is only _. RediSearch rejects a token without a letter or digit as a syntax error, so the whole fulltext query fails.

Because build_falkor_fulltext_query is also used inside add_episode (entity/edge dedup search), this crashes ingestion, not just search.

Repro

from graphiti_core.driver.falkordb import fulltext
fulltext.build_falkor_fulltext_query("name (_) date")
# -> ' (name | _ | date)'  -> RediSearch "Syntax error" when executed

We hit it in add_episode with LLM-extracted entity names of the form <name>_<date>.

Related: other symbol-only tokens survive too, e.g. "Report – _2025" -> ' (Report | – | _2025)'.

Suggested fix

After sanitizing, drop tokens that contain no alphanumeric character, e.g.

" ".join(w for w in sanitized.split() if any(c.isalnum() for c in w))

We currently patch the sanitizer at module level as a workaround.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions