From e6e3273caefcd69a5628d8c6a53d8fd047181014 Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Wed, 29 Oct 2025 10:50:25 +0200 Subject: [PATCH] Document include/exclude patterns in FileMonitor --- docs/configuration.md | 56 +++++++++++++++++++++++++++++++++++++++++++ docs/server.md | 27 +++++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index c03640af..a22c0428 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -58,6 +58,8 @@ storage: monitor_directories: - /path/to/documents - /another/path + monitor_ignore_patterns: [] # Gitignore-style patterns to exclude + monitor_include_patterns: [] # Gitignore-style patterns to include disable_autocreate: false vacuum_retention_seconds: 60 @@ -167,6 +169,60 @@ storage: - /another_path/to/documents ``` +### Filtering Monitored Files + +Use gitignore-style patterns to control which files are monitored: + +```yaml +storage: + monitor_directories: + - /path/to/documents + + # Exclude specific files or directories + monitor_ignore_patterns: + - "*draft*" # Ignore files with "draft" in the name + - "temp/" # Ignore temp directory + - "**/archive/**" # Ignore all archive directories + - "*.backup" # Ignore backup files + + # Only include specific files (whitelist mode) + monitor_include_patterns: + - "*.md" # Only markdown files + - "*.pdf" # Only PDF files + - "**/docs/**" # Only files in docs directories +``` + +**How patterns work:** + +1. **Extension filtering** - Only supported file types are considered +2. **Include patterns** - If specified, only matching files are included (whitelist) +3. **Ignore patterns** - Matching files are excluded (blacklist) +4. **Combining both** - Include patterns are applied first, then ignore patterns + +**Common patterns:** + +```yaml +# Only monitor markdown documentation, but ignore drafts +monitor_include_patterns: + - "*.md" +monitor_ignore_patterns: + - "*draft*" + - "*WIP*" + +# Monitor all supported files except in specific directories +monitor_ignore_patterns: + - "node_modules/" + - ".git/" + - "**/test/**" + - "**/temp/**" +``` + +Patterns follow [gitignore syntax](https://git-scm.com/docs/gitignore#_pattern_format): +- `*` matches anything except `/` +- `**` matches zero or more directories +- `?` matches any single character +- `[abc]` matches any character in the set + ## Embedding Providers If you use Ollama, you can use any pulled model that supports embeddings. diff --git a/docs/server.md b/docs/server.md index 0558654b..ef79e7f9 100644 --- a/docs/server.md +++ b/docs/server.md @@ -66,6 +66,33 @@ haiku-rag serve --monitor - **File Added/Modified**: Automatically parses and updates documents - **File Deleted**: Removes corresponding documents from database +### Filtering Files + +You can filter which files to monitor using gitignore-style patterns: + +```yaml +storage: + monitor_directories: + - /path/to/documents + + # Ignore patterns (exclude files) + monitor_ignore_patterns: + - "*draft*" # Ignore draft files + - "temp/" # Ignore temp directory + - "**/archive/**" # Ignore archive directories + + # Include patterns (whitelist files) + monitor_include_patterns: + - "*.md" # Only markdown files + - "**/docs/**" # Files in docs directories +``` + +**Pattern behavior:** +- Extension filtering is applied first (only supported file types) +- Include patterns create a whitelist (if specified) +- Ignore patterns exclude files +- Both can be combined for fine-grained control + ### Supported Formats The server can parse 40+ file formats including: