Search Articles
Query articles using structured category filters and BM25 full-text keyword search.
Usage
bash
# List available categories python search.py --list-categories # Browse all articles python search.py --limit 10 # Filter by categories python search.py --categories NEWS SCIENTIFIC # Keyword search (BM25 full-text search) python search.py --keywords "machine learning" # Combined filters python search.py --categories SCIENTIFIC --keywords "biology" # JSON output for piping python search.py --keywords "API" --format json | jq '.results[].id'
Parameters
| Parameter | Type | Description |
|---|---|---|
--list-categories | flag | List all available article categories |
--categories | list | Filter by categories (NEWS, SCIENTIFIC, etc.) |
--keywords | string | BM25 full-text search keywords |
--limit | int | Maximum results (default: 10) |
--offset | int | Pagination offset (default: 0) |
--format | choice | Output: table, json, csv |
--output | path | Output file for json/csv |
Output Formats
Table (default)
code
Search Results (3 found) ┏━━━━┳━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ ID ┃ Category ┃ Score ┃ Snippet ┃ ┡━━━━╇━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │ 6 │ SCIENTIFIC │ 0.15 │ ...machine learning... │ └────┴────────────┴───────┴──────────────────────────┘
JSON
json
{
"results": [
{
"id": 6,
"raw_article": "...",
"category": "SCIENTIFIC",
"keyword_score": 0.15,
"snippet": "...machine learning..."
}
],
"metadata": {
"total_results": 3,
"query_time_ms": 42.5,
"strategies_used": ["bm25_keyword_search", "category_filter"]
}
}
CSV
csv
id,raw_article,category,keyword_score,snippet 6,"...","SCIENTIFIC",0.15,"...machine learning..."
Examples
See references/examples.md for 30+ usage examples including:
- •Category filtering
- •Keyword search strategies
- •Date range queries
- •Pagination
- •Composing with jq, grep, and other tools
- •Batch processing workflows