Update documentation
This commit is contained in:
parent
f3565afdf7
commit
f0f844d21d
3 changed files with 57 additions and 0 deletions
|
|
@ -38,6 +38,9 @@ haiku-rag add-src document.pdf --meta source=manual
|
||||||
# Search
|
# Search
|
||||||
haiku-rag search "query"
|
haiku-rag search "query"
|
||||||
|
|
||||||
|
# Search with filters
|
||||||
|
haiku-rag search "query" --filter "uri LIKE '%.pdf' AND title LIKE '%paper%'"
|
||||||
|
|
||||||
# Ask questions
|
# Ask questions
|
||||||
haiku-rag ask "Who is the author of haiku.rag?"
|
haiku-rag ask "Who is the author of haiku.rag?"
|
||||||
|
|
||||||
|
|
|
||||||
12
docs/cli.md
12
docs/cli.md
|
|
@ -78,6 +78,18 @@ With options:
|
||||||
haiku-rag search "python programming" --limit 10
|
haiku-rag search "python programming" --limit 10
|
||||||
```
|
```
|
||||||
|
|
||||||
|
With filters (filter by document properties):
|
||||||
|
```bash
|
||||||
|
# Filter by URI pattern
|
||||||
|
haiku-rag search "neural networks" --filter "uri LIKE '%arxiv%'"
|
||||||
|
|
||||||
|
# Filter by exact title
|
||||||
|
haiku-rag search "transformers" --filter "title = 'Deep Learning Guide'"
|
||||||
|
|
||||||
|
# Combine multiple conditions
|
||||||
|
haiku-rag search "AI" --filter "uri LIKE '%.pdf' AND title LIKE '%paper%'"
|
||||||
|
```
|
||||||
|
|
||||||
## Question Answering
|
## Question Answering
|
||||||
|
|
||||||
Ask questions about your documents:
|
Ask questions about your documents:
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,48 @@ for chunk, relevance_score in results:
|
||||||
print(f"Document metadata: {chunk.document_meta}")
|
print(f"Document metadata: {chunk.document_meta}")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Filtering Search Results
|
||||||
|
|
||||||
|
Filter search results to only include chunks from documents matching specific criteria:
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Filter by document URI pattern
|
||||||
|
results = await client.search(
|
||||||
|
query="machine learning",
|
||||||
|
limit=5,
|
||||||
|
filter="uri LIKE '%arxiv%'"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Filter by exact document title
|
||||||
|
results = await client.search(
|
||||||
|
query="neural networks",
|
||||||
|
limit=5,
|
||||||
|
filter="title = 'Deep Learning Guide'"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Combine multiple filter conditions
|
||||||
|
results = await client.search(
|
||||||
|
query="AI research",
|
||||||
|
limit=5,
|
||||||
|
filter="uri LIKE '%.pdf' AND title LIKE '%paper%'"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Filter with any search type
|
||||||
|
results = await client.search(
|
||||||
|
query="transformers",
|
||||||
|
limit=5,
|
||||||
|
search_type="vector",
|
||||||
|
filter="uri LIKE '%huggingface%'"
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** Filters apply to document properties only. Available columns for filtering:
|
||||||
|
- `id` - Document ID
|
||||||
|
- `uri` - Document URI/URL
|
||||||
|
- `title` - Document title (if set)
|
||||||
|
- `created_at`, `updated_at` - Timestamps
|
||||||
|
- `metadata` - Document metadata (as string, use LIKE for pattern matching)
|
||||||
|
|
||||||
### Expanding Search Context
|
### Expanding Search Context
|
||||||
|
|
||||||
Expand search results with adjacent chunks for more complete context:
|
Expand search results with adjacent chunks for more complete context:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue