Skip to content

fix(knowledge): keep rerank passages nonempty#345

Draft
SiyaoZheng wants to merge 1 commit into
EverMind-AI:mainfrom
SiyaoZheng:fix/knowledge-rerank-nonempty-passages
Draft

fix(knowledge): keep rerank passages nonempty#345
SiyaoZheng wants to merge 1 commit into
EverMind-AI:mainfrom
SiyaoZheng:fix/knowledge-rerank-nonempty-passages

Conversation

@SiyaoZheng

@SiyaoZheng SiyaoZheng commented Jul 16, 2026

Copy link
Copy Markdown

Summary

Ensure knowledge rerank providers always receive a non-empty passage without changing the content returned by the search API.

Knowledge-topic content is loaded from SQLite before reranking. A valid topic can have blank content, which previously passed an empty document to the configured rerank provider. Some providers reject empty documents, while others return unstable scores.

This change adds a dedicated rerank_content field with the fallback order content -> summary -> topic_name -> topic id -> generic label. The original content field remains authoritative and unchanged for SearchHit.content.

Area

  • Architecture method
  • Benchmark
  • Use case
  • Documentation
  • Developer experience
  • CI, build, or release

Verification

uv run pytest tests/unit/test_service/test_knowledge_search.py -q
27 passed

make ci
1505 unit tests passed; 78 integration tests passed (6 deselected);
lint, architecture contracts, OpenAPI drift, package build, and wheel smoke test passed

Checklist

  • I kept the change scoped to the relevant area.
  • I am opening this from a separate branch, not pushing directly to main.
  • No documentation change is required because the public response contract is unchanged.
  • I added or updated tests when the change affects behavior.
  • I did not commit secrets, .env files, dependency folders, or generated output.
  • Active relative links in Markdown files resolve.

Notes for Reviewers

The tests cover SQLite content, metadata fallbacks, the all-blank case, and preservation of the API-facing content value.

By submitting this pull request, I agree that my contribution is licensed under the Apache License 2.0.

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.

1 participant