Document include/exclude patterns in FileMonitor
This commit is contained in:
parent
987ddab683
commit
e6e3273cae
2 changed files with 83 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue