LearnNewsExamplesServices
Frontmatter
id8420
titleFix Knowledge Base Indexing and Scoring for Source Code
stateClosed
labels
bugai
assigneestobiu
createdAtJan 8, 2026, 1:02 PM
updatedAtJan 8, 2026, 1:05 PM
githubUrlhttps://github.com/neomjs/neo/issues/8420
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 8, 2026, 1:05 PM

Fix Knowledge Base Indexing and Scoring for Source Code

Closed v11.19.0 bugai
tobiu
tobiu commented on Jan 8, 2026, 1:02 PM

The recent switch to SourceParser (Issue #8342) broke the inheritance chain resolution in VectorService and the scoring logic in QueryService.

Issues:

  1. SourceParser does not extract/emit className or extends metadata in the chunks.
  2. VectorService looks for chunk.kind === 'class' to build the inheritance map, which no longer exists.
  3. QueryService boosts scores for metadata.type === 'class', but source files now have type === 'src'.

Tasks:

  1. Update SourceParser.mjs:
    • Extract className and superClass from the AST.
    • Include className and extends metadata in all generated chunks.
  2. Update VectorService.mjs:
    • Adapt logic to read className and extends from the new chunk structure to rebuild the inheritance map.
  3. Update QueryService.mjs:
    • Adjust scoring logic to recognize type: 'src' and boost based on className match (replacing the dead type === 'class' check).

Goal: Restore intelligent scoring and inheritance-based boosting for source code queries.

tobiu added the bug label on Jan 8, 2026, 1:02 PM
tobiu added the ai label on Jan 8, 2026, 1:02 PM
tobiu assigned to @tobiu on Jan 8, 2026, 1:02 PM
tobiu referenced in commit b284f2e - "fix: KB indexing & scoring for source code (#8420)" on Jan 8, 2026, 1:04 PM
tobiu
tobiu Jan 8, 2026, 1:04 PM

Input from Gemini 3 Pro:

✦ I have refactored SourceParser, VectorService, and QueryService to correctly handle source code indexing.

Changes:

  1. SourceParser.mjs: Now extracts className and extends from the AST and injects them into every chunk generated for a class file.
  2. VectorService.mjs: Updated to build the inheritance map using the module-context chunks (which now contain the metadata) and applies the chain to all chunks with a className.
  3. QueryService.mjs: Removed the obsolete metadata.type === 'class' check. It now correctly boosts scores based on metadata.className matches, ensuring src files are properly ranked.

This restores the "Inheritance Boosting" and class-name relevance scoring that was lost during the switch to source code parsing.

tobiu closed this issue on Jan 8, 2026, 1:05 PM