Files
our-claude-skills/custom-skills/31-notion-organizer/commands/notion-search.md
Andrew Yim 69526d345a fix(notion-search): correct --filter example syntax in docs
Final review caught that both --filter example locations used simplified
JSON ({"Status": "Done"}) that Notion's data_sources.query API rejects
with a 400. The script passes --filter verbatim, so users copy-pasting
the example would hit a confusing error.

Replace with Notion's actual filter shape:
  {"property": "Status", "status": {"equals": "Done"}}

Also added a compound (and/or) example in CLAUDE.md so users have a
reference for combining filters.

30/30 tests still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 13:57:29 +09:00

51 lines
1.9 KiB
Markdown

---
description: Search Notion workspace semantically (LLM-expanded + reranked).
argument-hint: "<query> [--databases ID,...] [--filter JSON] [--limit N] [--no-rerank] [--no-expand] [--no-cache] [--json]"
---
Search the user's Notion workspace using semantic search powered by Claude Haiku query expansion and result reranking. Closes the gap left by Notion's keyword-only native search — handles synonyms, related concepts, and Korean ↔ English cross-language queries.
## Usage
Run the search script with the user's arguments:
```bash
cd ~/Project/our-claude-skills/custom-skills/31-notion-organizer/code/scripts
python3 notion_search.py "$ARGUMENTS"
```
## Common patterns
- **Default browse mode** (terminal table): `notion-search "AI agents in 2026"`
- **JSON for piping** (e.g. into the future notion-to-notebooklm push skill): `notion-search "AI agents" --json | jq '.[].id'`
- **Constrain to specific databases**: `notion-search "MCP" --databases f8f19ede-32bd-43ac-9f60-0651f6f40afe`
- **Property filter** (per-database mode, Notion's native filter shape): `notion-search "MCP" --databases ID --filter '{"property": "Status", "status": {"equals": "Done"}}'`
- **Fast mode (no LLM)**: `notion-search "exact phrase" --no-rerank --no-expand`
## Requirements
- `NOTION_API_KEY` or `NOTION_TOKEN` env var
- One of:
- `anthropic` SDK installed + `ANTHROPIC_API_KEY` env var, or
- Claude Code CLI (`claude` on PATH)
The skill auto-detects which is available; SDK is preferred when both are present.
## Output schema (JSON mode)
```json
[
{
"id": "abc-def-...",
"url": "https://notion.so/...",
"title": "Page title",
"relevance": 0.94,
"snippet": "Why it matched",
"excerpt": "First paragraph text...",
"properties": {"Status": "Done", "Topic": ["AI", "MCP"]}
}
]
```
`relevance` and `snippet` are `null` when `--no-rerank` is set. This schema is the contract for downstream tools (e.g., the future `notion-to-notebooklm` push skill).