Repository: vscode
Issue: Search does not find pattern in closed files
Labels: bug,info-needed,search


Type: <b>Bug</b>

Not able to find any information when using Search (Quick search included) for not opened files.
Below follows the output from Search Engine Trace logs:
```json
{
    "_reason": "searchView",
    "folderQueries": [
        {
            "folder": {
                "$mid": 1,
                "fsPath": "c:\\**\\**\\**\\**", // Obfuscated
                "_sep": 1,
                "external": "file:///c%3A/**/**/**/**", // Obfuscated
                "path": "/c:/**/**/**/**", // Obfuscated
                "scheme": "file"
            },
            "excludePattern": [
                {
                    "pattern": {
                        "**/.git": true,
                        "**/.svn": true,
                        "**/.hg": true,
                        "**/CVS": true,
                        "**/.DS_Store": true,
                        "**/Thumbs.db": true,
                        "**/node_modules": true,
                        "**/bower_components": true,
                        "**/*.code-search": true
                    }
                }
            ],
            "fileEncoding": "utf8",
            "disregardIgnoreFiles": true,
            "disregardGlobalIgnoreFiles": true,
            "disregardParentIgnoreFiles": true,
            "ignoreSymlinks": false
        }
    ],
    "usingSearchPaths": false,
    "onlyOpenEditors": false,
    "maxResults": 20000,
    "type": 2,
    "contentPattern": {
        "pattern": "20241028T190808.594+09:00",
        "isRegExp": false,
        "isCaseSensitive": false,
        "isWordMatch": false,
        "notebookInfo": {
            "isInNotebookMarkdownInput": true,
            "isInNotebookMarkdownPreview": true,
            "isInNotebookCellInput": true,
            "isInNotebookCellOutput": true
        },
        "wordSeparators": "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?"
    },
    "previewOptions": { "matchLines": 1, "charsPerLine": 1000 },
    "usePCRE2": false
}
```

VS Code version: Code 1.94.2 (384ff7382de624fb94dbaf6da11977bba1ecd427, 2024-10-09T16:08:44.566Z)
OS version: Windows_NT x64 10.0.19045
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|12th Gen Intel(R) Core(TM) i5-1245U (12 x 2496)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled<br>webnn: disabled_off|
|Load (avg)|undefined|
|Memory (System)|15.69GB (2.84GB free)|
|Process Argv|--crash-reporter-id 9b81992b-5f46-4376-95cb-8371addc56fb|
|Screen Reader|no|
|VM|0%|
</details><details><summary>Extensions (15)</summary>

Extension|Author (truncated)|Version
---|---|---
Bookmarks|ale|13.5.0
gitlens|eam|15.6.2
prettier-vscode|esb|11.0.0
gc-excelviewer|Gra|4.2.62
vscode-peacock|joh|4.2.2
rainbow-csv|mec|3.12.0
git-graph|mhu|1.30.0
vscode-docker|ms-|1.29.3
cpptools|ms-|1.22.10
cpptools-extension-pack|ms-|1.3.0
hexeditor|ms-|1.10.0
powershell|ms-|2024.2.2
material-icon-theme|PKi|5.12.0
vscode-xml|red|0.27.1
code-spell-checker|str|3.0.1

(1 theme extensions excluded)

</details>
<!-- generated by issue reporter -->