[BUG] Qdrant metadata content overwrites the indexed document body

オープン
#9,129 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Ymmcc がすでに取り組んでいます。

2026年11月5日 から。

  • #9130 @Ymmcc による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
databases

調査の方向性

Start at crewai/rag/qdrant/client.py and read _create_point_from_document, which the issue identifies as the shared payload helper for sync and async adds. The issue reports an open linked pull request (#9130) with regression tests already prepared. Done means the stored and returned document body remains the original text while non-conflicting metadata remains available.

索引モデルが issue の本文から書いたものです。

説明

Description

Qdrant document metadata containing a content key silently replaces the document text in the stored payload. The embedding is computed from document["content"], but search returns metadata["content"] as the document body. Both add_documents and aadd_documents use the same payload helper.

Reproduction

Reproduced on main at 6bd60b223101a11f7ac675706ff1ebb03314c95d (CrewAI 1.15.35), Windows, Python 3.12.15, qdrant-client 1.14.3. No server, model, or API key is needed:

from crewai.rag.qdrant.client import QdrantClient
from qdrant_client import QdrantClient as SDKClient
from qdrant_client.models import Distance, VectorParams

sdk = SDKClient(location=":memory:")
try:
    client = QdrantClient(client=sdk, embedding_function=lambda text: [1.0, 0.0, 0.0])
    client.create_collection(
        collection_name="content_repro",
        vectors_config=VectorParams(size=3, distance=Distance.COSINE),
    )
    client.add_documents(collection_name="content_repro", documents=[{
        "content": "Original document text",
        "metadata": {"content": "Metadata text", "source": "example.txt"},
    }])
    result = client.search(collection_name="content_repro", query="Original document text")[0]
    print(result["content"])
    assert result["content"] == "Original document text", result
finally:
    sdk.close()

Actual: prints Metadata text and fails the assertion. The equivalent async create/add/search sequence returns the same wrong text.

Expected: the canonical document body remains Original document text. Non-conflicting metadata such as source remains available.

Cause and proposed fix

_create_point_from_document builds {"content": doc["content"], **metadata}, so metadata wins on collision. Assigning the reserved payload content field after expanding metadata preserves the document body. This keeps the existing flat payload layout and metadata filtering behavior; it does not introduce a new metadata storage format or recover previously overwritten content.

I checked existing issues and open PRs for this collision and did not find a duplicate. A one-line fix and regression tests for mapping/list metadata and empty/nonempty text are ready. The four new cases fail before the fix; the full Qdrant test module passes (47 tests) after it. Real in-memory sync/async roundtrips were also checked.

AI disclosure

AI-generated contribution: the investigation, reproduction, proposed implementation, tests, and this report were prepared and run with an AI coding assistant at the contributor's request. Please apply the required llm-generated label if my account cannot manage repository labels.

主要言語
Python
スター
60.6k
フォーク
9.1k
平均マージ
1日 2時間
マージ済み PR(30日)
214

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

crewAIInc/crewAI のほかの issue

crewAIInc/crewAI の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。