Skip to content

Conversation

Copy link

Copilot AI commented Nov 22, 2025

The fulltext index is created with workspace-specific naming (entity_id_fulltext_idx_{workspace_label}) but search_labels queries the hardcoded name (entity_id_fulltext_idx). This causes IndexNotFound on new workspaces, forcing fallback to slow CONTAINS-based search.

Changes

  • search_labels method (line 1644): Use workspace-specific index name matching creation logic
  • Legacy migration (lines 243-270): Auto-migrate old entity_id_fulltext_idx indexes on init
  • Early loop exit: Break when both current and legacy indexes found during init scan

Test Coverage

Added tests/test_neo4j_fulltext_index.py with integration tests for:

  • Workspace-specific index creation and usage
  • Chinese text search with CJK analyzer
  • Multi-workspace index isolation
  • CONTAINS fallback when index unavailable
# Before: hardcoded index name
index_name = "entity_id_fulltext_idx"

# After: workspace-scoped
index_name = f"entity_id_fulltext_idx_{workspace_label}"
Original prompt

check the commit to this branch

we might need to make chanegs:

After renaming the index, data migration must also be considered to ensure that indexes in legacy systems are properly updated to the new name.

lightrag/kg/neo4j_impl.py
):
"""Create a full-text index on the entity_id property with Chinese tokenizer support."""
index_name = "entity_id_fulltext_idx"
index_name = f"entity_id_fulltext_idx_{workspace_label}"
@chatgpt-codex-connector
chatgpt-codex-connector bot
6 hours ago
P1 Badge Full-text search uses stale index name

The full-text index is now created as entity_id_fulltext_idx_{workspace_label}, but search_labels still calls db.index.fulltext.queryNodes with the hard-coded name entity_id_fulltext_idx (see around line 1644), so on any newly created workspace where only the workspace-specific index exists, queries will throw IndexNotFound and always fall back to the slower CONTAINS-based path. The new index is never used, negating the change and degrading search performance for new databases.

Useful? React with 👍 / 👎.

is all of this true? can we add unit tests?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update legacy index names for data migration Fix Neo4j fulltext index name mismatch between creation and query Nov 22, 2025
Copilot AI requested a review from netbrah November 22, 2025 20:22
Copilot finished work on behalf of netbrah November 22, 2025 20:22
@netbrah netbrah marked this pull request as ready for review November 22, 2025 20:23
@netbrah netbrah merged commit e9f2b13 into update-full-text-index-for-workspace Nov 22, 2025
@netbrah netbrah deleted the copilot/update-fulltext-index-name branch November 22, 2025 20:26
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.

2 participants