# Hacker News Search (`hackernews.search`)

Full-text search of Hacker News stories and comments, by relevance or date.

- **Route:** `POST /v1/run/hackernews.search`
- **Price:** $0.0015 per request ($1.50 per 1,000) · `cost_usd` on every response
- **Source:** Hacker News API + HN Search (Algolia) (`hackernews`) · failover: no
- **Measured latency:** not enough calls measured yet
- **Heavy response:** no

## Input

| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| `query` | string | yes |  |  |
| `type` | string | no | "story" |  |
| `sort` | string | no | "relevance" |  |
| `limit` | integer | no | 20 |  |
| `page` | integer | no | 0 |  |

## Output (`output` in the run envelope)

| Field | Meaning |
|---|---|
| `results` | Matching stories/comments with points, comments and links. |
| `total` | Total hits. |

## Example

```bash
curl -s -X POST https://getallapis.com/v1/run/hackernews.search \
  -H "Authorization: Bearer $GETALLAPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"postgres","limit":10}'
```

```python
from getallapis_client import Client
client = Client()  # reads GETALLAPIS_API_KEY
result = client.run('hackernews.search', {'query': 'postgres', 'limit': 10})
print(result['cost_usd'], result['output'])
```

```bash
getallapis run hackernews.search '{"query":"postgres","limit":10}'
```

Quote first (free, validates input): `POST /v1/quote/hackernews.search` with the same body.
