[FR] Support zoekt indexing of binary files
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
- #7 來自 @sudhanshu112233shukla —— 已關閉,未合併
評估
研究方向
Start with IndexBuilder.Add and DocChecker.Check in indexbuilder.go, especially their null-byte checks and skip-marker handling. First determine the intended behavior for PDFs and other binary files; done should include an agreed indexing approach and tests showing the desired result without incorrectly treating binary content as text.
由索引模型根據 Issue 內容生成。
描述
When trying to index binary files (like PDFs), they are skipped with the following reason: binary content at byte offset x. Seems like binary files with a byte offset don't play nice with zoekt for whatever reason.
Diagnosing with Ask:
You're absolutely correct! The primary reason PDFs and other binary files are skipped is because they contain null bytes (0x00), not just because of size limits or trigram counts.
The Null Byte Check
In IndexBuilder.Add() indexbuilder.go:428-431:
if idx := bytes.IndexByte(doc.Content, 0); idx >= 0 {
doc.SkipReason = fmt.Sprintf("binary content at byte offset %d", idx)
doc.Language = "binary"
}
This checks if there's a null byte anywhere in the file content. If found, it:
- Sets the
SkipReasonto indicate where the binary content was detected - Marks the language as "binary"
Then the content is replaced indexbuilder.go:433-440:
if doc.SkipReason != "" {
doc.Content = []byte(notIndexedMarker + doc.SkipReason)
doc.Symbols = nil
doc.SymbolsMetaData = nil
if doc.Language == "" {
doc.Language = "skipped"
}
}
The file content is replaced with a marker string like "NOT-INDEXED: binary content at byte offset 5" indexbuilder.go:386.
Similar Check in DocChecker
The DocChecker.Check() method has an identical check indexbuilder.go:544-546:
if index := bytes.IndexByte(content, 0); index > 0 {
return fmt.Errorf("binary data at byte offset %d", index)
}
Bottom line: PDFs cannot be indexed in Zoekt because they contain null bytes, which are fundamental to binary file formats. The presence of even a single null byte causes the file to be marked as binary and excluded from text-based indexing. There's no configuration option to override this behavior since Zoekt is designed specifically for text-based source code search.
- 主要語言
- TypeScript
- 星號
- 3.9k
- 分支
- 374
- 平均合併
- 2 天 13 小時
- 30 天內合併 PR
- 48
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
sourcebot-dev/sourcebot 的其他 Issue
-
[bug] Search result hydration performs duplicate repository lookups within the same chunk可能已有人在做 @dipeshbabu 於 16 天前認領。 未關閉bug triage needed
難度 2/5 1-3 小時 新手友好度 84/100
sourcebot-dev/sourcebot#1681 · 1 則留言 ·
維護者通常 1 天內回覆
-
Linux ctags build instructions in CONTRIBUTING.md are missing build dependencies可能已有人在做 @The-AarushiSingh 於 22 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
sourcebot-dev/sourcebot#1633 ·
維護者通常 1 天內回覆
-
MCP ask_codebase rejects explicit languageModel: getLanguageModelKey includes displayName which the MCP schema doesn't expose可能已有人在做 @pranav718 於 39 天前認領。 未關閉ask_sb bug
難度 2/5 1-3 小時 新手友好度 76/100
sourcebot-dev/sourcebot#1137 · 4 則留言 ·
維護者通常 1 天內回覆
-
[FR] Support file-based and Azure Key Vault token sources alongside env and googleCloudSecret可能重新可做 關聯的 PR 已關閉且未合併。 未關閉
難度 4/5 3-5 天 新手友好度 64/100
sourcebot-dev/sourcebot#1704 · 1 則留言 ·
維護者通常 1 天內回覆
-
[bug] Local repositories with a space or non-ASCII character in the path cannot be indexed可能已有人在做 @breken-ai 於 13 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 35/100
sourcebot-dev/sourcebot#1689 ·
維護者通常 1 天內回覆
查看 sourcebot-dev/sourcebot 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 72/100
yjh051108/dsh-routing-suite#216 ·
-
kind/bug priority/needs-triage
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
Dependencies view: `getParent` loops forever on untitled documents, extension host runs out of memory可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉bug
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 1 天內回覆
-
enhancement good first issue
難度 2/5 半天 新手友好度 66/100
apache/fineract-consumer-facing#175 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1 小時以內 新手友好度 82/100
awslabs/visual-asset-management-system#413 ·
維護者通常 1 天內回覆