DocumentSplitter misplaces repeated literal chunks from an overlapping custom splitter
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
調査の方向性
haystack/components/preprocessors/document_splitter.pyの349~373行付近にあるカスタム分割オフセット検索と、test/components/preprocessors/test_document_splitter.pyの346~371行付近にある既存のスライディングウィンドウテストを読んでください。まずそのテストを実行し、繰り返し重複するチャンクを使うケースに変更してください。4つのチャンクが[0, 3, 6, 9]から始まり、それらのオーバーラップメタデータが対応するソース範囲と一致し、retrieverがgo go go go go goを返せば修正完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
When a custom DocumentSplitter callback returns overlapping windows of repeated text, later copies can be picked in place of the actual overlapping windows. Some split_idx_start values then point beyond the source. A SentenceWindowRetriever using those chunks returns duplicated text.
Error message
No exception is raised.
Expected behavior
The four windows below have exactly four increasing literal source starts, [0, 3, 6, 9]. Their overlap metadata should describe those ranges, and the retrieved window should be go go go go go go. The existing custom-splitter test checks source offsets and overlap metadata for a sliding window with distinct text. Existing sliding-window test
Additional context
The splitter searches from the end of the previous chunk and only tries an earlier overlap when that search fails. For the second chunk below, it finds a later occurrence at offset 9. The third and fourth chunks then take the running fallback offsets, 17 and 25. Built-in word splitting with the same source and window sizes gives the expected offsets and text. Custom split offset lookup
To Reproduce
from haystack import Document
from haystack.components.preprocessors import DocumentSplitter
from haystack.components.retrievers import SentenceWindowRetriever
from haystack.document_stores.in_memory import InMemoryDocumentStore
def sliding_window(text):
words = text.split(" ")
return [" ".join(words[i : i + 3]) for i in range(len(words) - 2)]
text = "go go go go go go"
splitter = DocumentSplitter(
split_by="function",
splitting_function=sliding_window,
split_length=3,
split_overlap=2,
)
chunks = splitter.run(documents=[Document(content=text)])["documents"]
store = InMemoryDocumentStore()
store.write_documents(chunks)
retriever = SentenceWindowRetriever(document_store=store, window_size=len(chunks))
result = retriever.run(retrieved_documents=[chunks[2]])
print([chunk.meta["split_idx_start"] for chunk in chunks])
print(result["context_windows"][0])
Output on main:
[0, 9, 17, 25]
go go gogo go gogo go gogo go go
FAQ Check
- Read the Haystack FAQ.
System
- Ubuntu 24.04.2 LTS, x86_64
- Python 3.12.14
- Haystack main at
bbf5b2b429670fa866e388f9a734ff3b1c652bf8(VERSION.txtreports3.6.0-rc0)
OpenAI Codex prepared and ran the reproduction.
- 主要言語
- Python
- スター
- 27.1k
- フォーク
- 3.5k
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 239
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
deepset-ai/haystack のほかの issue
-
BlockingConfirmationStrategy ignores an empty argument replacement対応中かも @Aarkin7 が 3 日前に担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
deepset-ai/haystack#13863 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
P2
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
deepset-ai/haystack#13830 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
CSVToDocument accepts an unsupported conversion_mode and silently converts in row mode対応中かも @Lesereingrape が 54 日前に担当しました。 オープンP3
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
deepset-ai/haystack#13070 ·
メンテナーはふだん 1 日以内に返信
-
InMemoryDocumentStore: count_unique_metadata_by_filter and get_metadata_field_unique_values disagree on int/float/bool values対応中かも @sjrl が 14 日前に担当しました。 オープンP3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
deepset-ai/haystack#13040 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
CSVToDocument row mode fails on CR-separated CSV input対応中かも @julian-risch が 55 日前に担当しました。 オープンP3
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
deepset-ai/haystack#13022 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
deepset-ai/haystack の issue をすべて見る
似ている issue
-
app: scripts status: backlog type: housekeeping
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
netbox-community/netbox-scripts#239 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
LmeSzinc/AzurLaneAutoScript#6194 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
micronaut-projects/micronaut-core#14585 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
langgenius/graphon#443 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信