Skip to content

OR搜尋(正規表達式管道運算子)無法正常運作 #11

@aimasteracc

Description

@aimasteracc

Multilingual GitHub Issue / 多言語GitHub Issue / 多語言GitHub Issue

This issue is provided in multiple languages to ensure accessibility for developers from different language communities. This is a standard practice in international open-source projects to facilitate better communication and collaboration across diverse developer communities.

このIssueは、異なる言語圏の開発者がアクセスしやすくするために複数言語で提供されています。これは国際的なオープンソースプロジェクトにおいて、多様な開発者コミュニティ間でのより良いコミュニケーションと協力を促進するための標準的な慣行です。

此Issue以多種語言提供,以確保不同語言社群的開發者都能輕鬆存取。這是國際開源專案的標準做法,旨在促進多元開發者社群間更好的溝通與協作。


🇹🇼 繁體中文版 (Traditional Chinese)


OR搜尋(正規表達式管道運算子)無法正常運作

問題概述

使用 search_code_advanced 工具執行 OR 搜尋(使用 | 運算子的正規表達式)時,搜尋結果為 0 筆,無法獲得預期的結果。單一搜尋可正常運作,直接執行 ripgrep 也能正常運作,因此推測是 code-index-mcp 內部的參數處理或指令建構存在問題。

重現步驟

  1. 連接至 code-index-mcp 伺服器
  2. 設定專案路徑
  3. 使用以下參數執行 search_code_advanced
    {
      "pattern": "ERROR|WARN",
      "fuzzy": true,
      "case_sensitive": false
    }

預期行為

  • 回傳包含 "ERROR" 或 "WARN" 的行作為搜尋結果
  • 獲得與直接執行 ripgrep 相同的結果(68 行)

實際行為

  • 搜尋結果為 0 筆
  • 未顯示錯誤訊息

環境資訊

  • 作業系統: Windows 11
  • code-index-mcp: 最新版本
  • ripgrep: 可用(直接執行時正常運作)
  • Python: 透過 uvx 執行

測試結果詳細

測試資料

提供的測試日誌檔案:

  • error-only-test.log: 25行ERROR日誌
  • warn-only-test.log: 25行WARN日誌
  • error-warn-test.log: 28行混合日誌(包含ERROR、WARN、INFO、DEBUG)

error-only-test.log
error-warn-test.log
warn-only-test.log

單一搜尋(正常運作)

pattern: "ERROR" → 偵測到 34 行
pattern: "WARN" → 偵測到 34 行

OR 搜尋(失敗)

pattern: "ERROR|WARN" → 偵測到 0 行

ripgrep 直接執行(正常運作)

rg "ERROR|WARN" --ignore-case
# 結果: 偵測到 68 行

預期結果分析

根據測試檔案內容,OR搜尋應該偵測到:

  • error-only-test.log: 25行ERROR
  • warn-only-test.log: 25行WARN
  • error-warn-test.log: 9行ERROR + 9行WARN = 18行
  • 總計: 25 + 25 + 18 = 68行

附加資訊

  • 問題發生於 fuzzy=true 的情況下
  • 尚未確認 fuzzy=false 時的運作狀況
  • 尚未確認其他正規表達式運算子(.*\w+ 等)的運作狀況
  • 未輸出錯誤日誌或除錯資訊

建議標籤

  • bug
  • search
  • regex
  • priority:medium

🇯🇵 日本語版 (Japanese)


OR検索(正規表現パイプ演算子)が機能しない

問題の概要

search_code_advancedツールでOR検索(|演算子を使用した正規表現)を実行すると、検索結果が0件となり、期待される結果が得られません。単体検索は正常に動作し、ripgrepを直接実行した場合も正常に動作するため、code-index-mcp内部のパラメータ処理またはコマンド構築に問題があると考えられます。

再現手順

  1. code-index-mcpサーバーに接続
  2. プロジェクトパスを設定
  3. 以下のパラメータでsearch_code_advancedを実行:
    {
      "pattern": "ERROR|WARN",
      "fuzzy": true,
      "case_sensitive": false
    }

期待される動作

  • "ERROR"または"WARN"を含む行が検索結果として返される
  • ripgrepの直接実行結果と同等の結果(68行)が得られる

実際の動作

  • 検索結果が0件となる
  • エラーメッセージは表示されない

環境情報

  • OS: Windows 11
  • code-index-mcp: 最新版
  • ripgrep: 利用可能(直接実行では正常動作)
  • Python: uvx経由で実行

テスト結果詳細

テストデータ

提供されたテストログファイル:

  • error-only-test.log: 25行のERRORログ
  • warn-only-test.log: 25行のWARNログ
  • error-warn-test.log: 28行の混合ログ(ERROR、WARN、INFO、DEBUGを含む)

error-only-test.log
error-warn-test.log
warn-only-test.log

単体検索(正常動作)

pattern: "ERROR" → 34行検出
pattern: "WARN" → 34行検出

OR検索(失敗)

pattern: "ERROR|WARN" → 0行検出

ripgrep直接実行(正常動作)

rg "ERROR|WARN" --ignore-case
# 結果: 68行検出

期待結果の分析

テストファイルの内容に基づくと、OR検索で検出されるべき行数:

  • error-only-test.log: 25行のERROR
  • warn-only-test.log: 25行のWARN
  • error-warn-test.log: 9行のERROR + 9行のWARN = 18行
  • 合計: 25 + 25 + 18 = 68行

追加情報

  • 問題はfuzzy=trueの場合に発生
  • fuzzy=falseでの動作は未確認
  • 他の正規表現演算子(.*, \w+など)の動作は未確認
  • エラーログやデバッグ情報は出力されない

提案されるラベル

  • bug
  • search
  • regex
  • priority:medium

🇺🇸 English Version


OR Search (Regex Pipe Operator) Not Working

Issue Summary

When executing OR search (regex using | operator) with the search_code_advanced tool, the search returns 0 results and fails to produce expected outcomes. Individual searches work correctly, and direct ripgrep execution also works properly, suggesting an issue with parameter processing or command construction within code-index-mcp.

Steps to Reproduce

  1. Connect to code-index-mcp server
  2. Set project path
  3. Execute search_code_advanced with the following parameters:
    {
      "pattern": "ERROR|WARN",
      "fuzzy": true,
      "case_sensitive": false
    }

Expected Behavior

  • Lines containing "ERROR" or "WARN" should be returned in search results
  • Should get equivalent results to direct ripgrep execution (68 lines)

Actual Behavior

  • Search returns 0 results
  • No error messages are displayed

Environment

  • OS: Windows 11
  • code-index-mcp: Latest version
  • ripgrep: Available (works correctly with direct execution)
  • Python: Running via uvx

Detailed Test Results

Test Data

Provided test log files:

  • error-only-test.log: 25 lines of ERROR logs
  • warn-only-test.log: 25 lines of WARN logs
  • error-warn-test.log: 28 lines of mixed logs (containing ERROR, WARN, INFO, DEBUG)

error-only-test.log
error-warn-test.log
warn-only-test.log

Individual Search (Working)

pattern: "ERROR" → 34 lines detected
pattern: "WARN" → 34 lines detected

OR Search (Failing)

pattern: "ERROR|WARN" → 0 lines detected

Direct ripgrep Execution (Working)

rg "ERROR|WARN" --ignore-case
# Result: 68 lines detected

Expected Results Analysis

Based on test file contents, OR search should detect:

  • error-only-test.log: 25 lines of ERROR
  • warn-only-test.log: 25 lines of WARN
  • error-warn-test.log: 9 lines of ERROR + 9 lines of WARN = 18 lines
  • Total: 25 + 25 + 18 = 68 lines

Additional Information

  • Issue occurs when fuzzy=true
  • Behavior with fuzzy=false is unconfirmed
  • Behavior of other regex operators (.*, \w+, etc.) is unconfirmed
  • No error logs or debug information is output

Suggested Labels

  • bug
  • search
  • regex
  • priority:medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions