> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://stelltec.com/rhebok/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://stelltec.com/rhebok/docs/_mcp/server.

# Preview an ignore pattern

GET http://127.0.0.1:7331/api/ignore/preview

Shows how many of the currently skipped files (those not already
ignored) an `ignore` entry would match, with up to five sample paths.
A pattern that does not parse is a 200 with `error` set.


Reference: https://stelltec.com/rhebok/docs/api/index/preview-ignore

## Request

### Query parameters

- `pattern` (string, required) — The `ignore` entry to try. If `pattern` is given more than once, the first one is used.

## Response

### 200

The match count, or why the pattern is invalid.

- `error` (string, required, nullable) — Why the pattern is invalid, or null.
- `matches` (integer, required)
- `of` (integer, required) — How many skipped files were tested.
- `sample` (list of string, required)

## Errors

### 421 Misdirected Request Error

The `Host` header does not name this dashboard (see the rules at the top of this page).

- `error` (string, required) — What went wrong, in plain words.

### 500 Internal Server Error

lbug's `vector` extension could not be loaded. This is a stable state, so `stable` is true and a retry will not help.

- `error` (string, required) — The message, which names the extension directory.
- `stable` (true, required) — Always true. The state will not clear on retry.

### 503 Service Unavailable Error

The index store could not be opened or read right now. A retry can succeed.

- `error` (string, required) — What went wrong, in plain words.

## Examples

**Response**

```json
{
  "error": null,
  "matches": 2,
  "of": 5,
  "sample": [
    "/Users/me/vault/scans/receipt.pdf",
    "/Users/me/vault/scans/lease.pdf"
  ]
}
```

**SDK Code**

```python Index_previewIgnore_example
import requests

url = "http://127.0.0.1:7331/api/ignore/preview"

querystring = {"pattern":"scans/**"}

response = requests.get(url, params=querystring)

print(response.json())
```

```javascript Index_previewIgnore_example
const url = 'http://127.0.0.1:7331/api/ignore/preview?pattern=scans%2F**';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Index_previewIgnore_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "http://127.0.0.1:7331/api/ignore/preview?pattern=scans%2F**"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Index_previewIgnore_example
require 'uri'
require 'net/http'

url = URI("http://127.0.0.1:7331/api/ignore/preview?pattern=scans%2F**")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
```

```java Index_previewIgnore_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("http://127.0.0.1:7331/api/ignore/preview?pattern=scans%2F**")
  .asString();
```

```php Index_previewIgnore_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://127.0.0.1:7331/api/ignore/preview?pattern=scans%2F**');

echo $response->getBody();
```

```csharp Index_previewIgnore_example
using RestSharp;

var client = new RestClient("http://127.0.0.1:7331/api/ignore/preview?pattern=scans%2F**");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift Index_previewIgnore_example
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "http://127.0.0.1:7331/api/ignore/preview?pattern=scans%2F**")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```