# Remove the top sites

One number takes the most popular sites out of the results, so a search reaches the rest of the web.

Most searches return the same few hundred sites. They are popular, they are well optimised, and for many questions they are not where the best answer is. `remove_top_sites` takes them out.

```text
"remove_top_sites": 10000
```

That removes every result whose site is among the 10,000 most popular sites. What is left is the long tail: specialist sites, personal sites, forums, small publishers, primary sources. This is what MillionShort is named for: the web, a million sites short.

## What the number means

Every site has a popularity rank. Rank 1 is the most popular site there is. `remove_top_sites: N` removes results from sites ranked 1 to N. The value can be any whole number from 0 to 1,000,000; 0, the default, removes nothing.

| Value | What goes | What is left |
|---|---|---|
| `100` | The giants: the largest platforms and portals | Nearly everything else |
| `1000` | Plus the big publishers, retailers and reference sites | Mid-sized and smaller sites |
| `10000` | Plus most sites you know by name | Specialist and independent sites. A good first value |
| `100000` | Plus most commercial publishers | Small sites, clubs, personal pages |
| `1000000` | Every site with a rank | Only sites outside the top million |

There is no right number. Start at 10,000, look at `popularity` on what comes back, and move up or down.

## Try it

```bash
curl https://api.millionshort.com/v1/search \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "restoring a cast iron skillet",
    "remove_top_sites": 10000,
    "num_results": 8
  }'
```

```python
import os

from millionshort import MillionShort

client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"])

r = client.search(
    "restoring a cast iron skillet",
    remove_top_sites=10000,
    num_results=8,
)
for hit in r.results:
    print(hit["popularity"]["rank"], hit["popularity"]["bucket"], hit["site"])
```

```ts
import { MillionShort } from 'millionshort';

const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY });

const r = await client.search('restoring a cast iron skillet', {
  removeTopSites: 10000,
  numResults: 8,
});
for (const hit of r.results) {
  console.log(hit.popularity.rank, hit.popularity.bucket, hit.site);
}
```

The same call as a tool of the MCP server:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "search",
    "arguments": {
      "query": "restoring a cast iron skillet",
      "remove_top_sites": 10000,
      "num_results": 8
    }
  }
}
```

Every result that comes back has a rank above 10,000, or no rank at all.

## How to read the results

Each result carries the popularity of its site, whether or not you removed anything:

```json
{
  "data": {
    "results": [
      {
        "title": "Restoring a rusted skillet: notes from thirty years at a foundry",
        "url": "https://example.org/skillet-restoration",
        "site": "example.org",
        "source": "web",
        "snippet": "Strip the old seasoning down to bare iron before you start...",
        "highlights": ["Strip the old seasoning down to bare iron before you start..."],
        "published_date": null,
        "page_type": "articles",
        "topic": "home",
        "popularity": { "rank": 48210, "bucket": "top-100k" },
        "risk": null,
        "position": 1,
        "score": 1.0,
        "extra": {}
      }
    ],
    "summary": {
      "returned": 8,
      "removed": { "popularity": 0, "blocked": 0, "duplicates": 2, "risk": 0, "safe_search": 0 }
    },
    "warnings": []
  },
  "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "search": 1 } },
  "warnings": [],
  "request_id": "req_..."
}
```

The values are an illustration and the list is cut to one result.

- `popularity.rank` is the site's rank, or `null` when the site is outside the top 1,000,000 or has no rank.
- `popularity.bucket` is the same thing as a band: `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, `long-tail` or `unknown`.
- `summary.removed.popularity` counts results the cut took out of the list. For some sources, `web` and `news` among them, the cut is applied before results are counted, so this number can be 0 when the cut plainly worked. Judge by the `popularity` of what came back.

Things worth knowing:

- **Rank belongs to the site, not the page.** A page on a subdomain of a large hosting or blogging platform carries the platform's rank. Removing the top 1,000 sites therefore also removes the personal pages hosted on those platforms. The `smallweb` source is another way to reach them.
- **A site with no rank is kept.** `remove_top_sites` only removes sites that have a rank inside the number.
- **It is free.** The cut costs nothing extra, at any value.
- **You still get a full list.** The search looks further down for results to replace the ones removed. If it cannot find enough, the call returns what there is with a `short_results` warning.

## The reverse: only the top sites

`only_top_sites: N` keeps only results from the N most popular sites. Use it when you want the mainstream view, or as the other half of a comparison.

```bash
curl https://api.millionshort.com/v1/search \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "restoring a cast iron skillet", "only_top_sites": 1000 }'
```

```python
import os

import requests

r = requests.post(
    "https://api.millionshort.com/v1/search",
    headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]},
    json={
        "query": "restoring a cast iron skillet",
        "only_top_sites": 1000
    },
    timeout=30,
)
r.raise_for_status()
for hit in r.json()["data"]["results"]:
    print(hit["position"], hit["title"], hit["url"])
```

```ts
const res = await fetch('https://api.millionshort.com/v1/search', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "query": "restoring a cast iron skillet",
    "only_top_sites": 1000
  }),
});
if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`);
const { data } = (await res.json()) as {
  data: { results: { position: number; title: string; url: string }[] };
};
for (const hit of data.results) console.log(hit.position, hit.title, hit.url);
```

The same call as a tool of the MCP server:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "search",
    "arguments": {
      "query": "restoring a cast iron skillet",
      "only_top_sites": 1000
    }
  }
}
```

- A result whose site has no rank is removed, so on sources whose results have no site rank (`hn`, `communities`) `only_top_sites` can return nothing. The search still ran, so it still costs its credit.
- Sending both `remove_top_sites` and `only_top_sites` above 0 is a `400 INVALID_PARAM`. Send one.

## Which sources it suits

The cut is most useful on `web` and `news`, where the sites are of every size. On `smallweb` most results are already outside the top million. On sources whose results are threads, posts, papers or records, the site rank says little, and the cut is best left at 0. Each [source page](https://millionshort.com/docs/search/sources) says how popularity behaves there.

## Agent recipe: look under the first page

1. Search with no cut and read `popularity.bucket` on the results.
2. If most are `top-100` to `top-10k`, search again with `remove_top_sites: 10000`.
3. Keep results from both passes, drop any with a `risk` label (`exclude_risky: true` does that in the request), and tell the person which sources are well known and which are small sites.

Two searches, two credits. [Long-tail research](https://millionshort.com/docs/search/guides/long-tail-research) has the code, and [Filters for agents](https://millionshort.com/docs/search/filters) has more recipes.

## With the other controls

- `remove_top_sites` removes by rank. [Lenses](https://millionshort.com/docs/search/lenses) act on sites you name: remove one, keep only a few, move some up or down.
- An agent can apply its own rule after the search, using `popularity` on each result. [Popularity and risk](https://millionshort.com/docs/search/popularity-and-risk) covers the signals.
- [Spaces](https://millionshort.com/docs/search/spaces) save a cut together with sites, page types and topics under one name.
- Older clients sent `index_level` with values such as `top10k`. It still works and means the same as `remove_top_sites: 10000`.
