# How a Google search finds and ranks an answer

> A process map exported from forks.world (https://forks.world). Author: Brian. Source: https://forks.world/p/cmv21nslz001vl206s8l1hj9t
> It describes who does what, in what order, and with which technology. Read the plain-language sections first; the JSON at the end is the exact, complete data.

## Summary

- 15 steps across 2 layers
- Persona: You
- Technology / systems: Web crawler, Search index, Ranking system, Websites

## How to read this file

- A process is made of **layers**. The main layer is the top level; any step of kind `subprocess` opens a detail layer with its own lanes and steps.
- **Lanes** are either persona (people/roles) or technology (systems). Each step belongs to one lane; `using` lists tools a person uses for that step.
- Step kinds: `start`, `task`, `decision` (its arrows carry the answer as a label), `subprocess`, `end`.

## How a Google search finds and ranks an answer

Lanes:
- You: person / role (id `you`)
- Web crawler: technology / system (id `crawler`)
- Search index: technology / system (id `index`)
- Ranking system: technology / system (id `ranker`)
- Websites: technology / system (id `sites`)

Steps, in the order they run:

1. **Follows links across the web all day** [start; Web crawler; id `q1`]
   - then Pages are fetched and read
2. **Pages are fetched and read** [task; Websites; id `q2`]
   - then Page contents are stored in a giant index
3. **Page contents are stored in a giant index** [task; Search index; id `q3`]
   - then You type a question
4. **You type a question** [task; You; id `q4`]
   - then Understands what you mean, not only the words
5. **Understands what you mean, not only the words** [subprocess; Ranking system; id `q5`], opens the detail layer "What decides the order"
   - then Pulls every page that might answer it
6. **Pulls every page that might answer it** [task; Search index; id `q6`]
   - then Scores each page on relevance, quality, speed and links
7. **Scores each page on relevance, quality, speed and links** [task; Ranking system; id `q7`]
   - then Adds your location and language
8. **Adds your location and language** [task; Ranking system; id `q8`]
   - then Sees the top results in under a second
9. **Sees the top results in under a second** [task; You; id `q9`]
   - then Does the first result answer it?
10. **Does the first result answer it?** [decision; You; id `q10`]
   - if "Yes" go to The site gets the visit; if "No" go to You type a question
11. **The site gets the visit** [end; Websites; id `q11`]

```mermaid
flowchart LR
  subgraph l_you["You"]
    n_q4["You type a question"]
    n_q9["Sees the top results in under a second"]
    n_q10{"Does the first result answer it?"}
  end
  subgraph l_crawler["Web crawler"]
    n_q1(["Follows links across the web all day"])
  end
  subgraph l_index["Search index"]
    n_q3["Page contents are stored in a giant index"]
    n_q6["Pulls every page that might answer it"]
  end
  subgraph l_ranker["Ranking system"]
    n_q5[["Understands what you mean, not only the words"]]
    n_q7["Scores each page on relevance, quality, speed and links"]
    n_q8["Adds your location and language"]
  end
  subgraph l_sites["Websites"]
    n_q2["Pages are fetched and read"]
    n_q11(["The site gets the visit"])
  end
  n_q1 --> n_q2
  n_q2 --> n_q3
  n_q3 --> n_q4
  n_q4 --> n_q5
  n_q5 --> n_q6
  n_q6 --> n_q7
  n_q7 --> n_q8
  n_q8 --> n_q9
  n_q9 --> n_q10
  n_q10 -->|"Yes"| n_q11
  n_q10 -->|"No"| n_q4
```

### What decides the order (detail of step "Understands what you mean, not only the words")

Lanes:
- Ranking system: technology / system (id `ranker`)
- Search index: technology / system (id `index`)

Steps, in the order they run:

1. **Is the page about the question?** [start; Ranking system; id `r1`]
   - then Do other trusted pages link to it?
2. **Do other trusted pages link to it?** [task; Ranking system; id `r2`]
   - then Is it fast and safe on a phone?
3. **Is it fast and safe on a phone?** [task; Ranking system; id `r3`]
   - then Is it fresh and original?
4. **Is it fresh and original?** [end; Ranking system; id `r4`]

```mermaid
flowchart LR
  subgraph l_ranker["Ranking system"]
    n_r1(["Is the page about the question?"])
    n_r2["Do other trusted pages link to it?"]
    n_r3["Is it fast and safe on a phone?"]
    n_r4(["Is it fresh and original?"])
  end
  n_r1 --> n_r2
  n_r2 --> n_r3
  n_r3 --> n_r4
```

## Full data (JSON)

```json
{
  "title": "How a Google search finds and ranks an answer",
  "maps": {
    "m_rank": {
      "id": "m_rank",
      "lanes": [
        {
          "id": "ranker",
          "name": "Ranking system",
          "type": "system"
        },
        {
          "id": "index",
          "name": "Search index",
          "type": "system"
        }
      ],
      "steps": [
        {
          "id": "r1",
          "kind": "start",
          "lane": "ranker",
          "next": [
            {
              "to": "r2"
            }
          ],
          "uses": [],
          "label": "Is the page about the question?"
        },
        {
          "id": "r2",
          "kind": "task",
          "lane": "ranker",
          "next": [
            {
              "to": "r3"
            }
          ],
          "uses": [],
          "label": "Do other trusted pages link to it?"
        },
        {
          "id": "r3",
          "kind": "task",
          "lane": "ranker",
          "next": [
            {
              "to": "r4"
            }
          ],
          "uses": [],
          "label": "Is it fast and safe on a phone?"
        },
        {
          "id": "r4",
          "kind": "end",
          "lane": "ranker",
          "next": [],
          "uses": [],
          "label": "Is it fresh and original?"
        }
      ],
      "title": "What decides the order",
      "parent": {
        "map": "m_root",
        "step": "q5"
      }
    },
    "m_root": {
      "id": "m_root",
      "lanes": [
        {
          "id": "you",
          "name": "You",
          "type": "person"
        },
        {
          "id": "crawler",
          "name": "Web crawler",
          "type": "system"
        },
        {
          "id": "index",
          "name": "Search index",
          "type": "system"
        },
        {
          "id": "ranker",
          "name": "Ranking system",
          "type": "system"
        },
        {
          "id": "sites",
          "name": "Websites",
          "type": "system"
        }
      ],
      "steps": [
        {
          "id": "q1",
          "kind": "start",
          "lane": "crawler",
          "next": [
            {
              "to": "q2"
            }
          ],
          "uses": [],
          "label": "Follows links across the web all day"
        },
        {
          "id": "q2",
          "kind": "task",
          "lane": "sites",
          "next": [
            {
              "to": "q3"
            }
          ],
          "uses": [],
          "label": "Pages are fetched and read"
        },
        {
          "id": "q3",
          "kind": "task",
          "lane": "index",
          "next": [
            {
              "to": "q4"
            }
          ],
          "uses": [],
          "label": "Page contents are stored in a giant index"
        },
        {
          "id": "q4",
          "kind": "task",
          "lane": "you",
          "next": [
            {
              "to": "q5"
            }
          ],
          "uses": [],
          "label": "You type a question"
        },
        {
          "id": "q5",
          "kind": "subprocess",
          "lane": "ranker",
          "next": [
            {
              "to": "q6"
            }
          ],
          "uses": [],
          "child": "m_rank",
          "label": "Understands what you mean, not only the words"
        },
        {
          "id": "q6",
          "kind": "task",
          "lane": "index",
          "next": [
            {
              "to": "q7"
            }
          ],
          "uses": [],
          "label": "Pulls every page that might answer it"
        },
        {
          "id": "q7",
          "kind": "task",
          "lane": "ranker",
          "next": [
            {
              "to": "q8"
            }
          ],
          "uses": [],
          "label": "Scores each page on relevance, quality, speed and links"
        },
        {
          "id": "q8",
          "kind": "task",
          "lane": "ranker",
          "next": [
            {
              "to": "q9"
            }
          ],
          "uses": [],
          "label": "Adds your location and language"
        },
        {
          "id": "q9",
          "kind": "task",
          "lane": "you",
          "next": [
            {
              "to": "q10"
            }
          ],
          "uses": [],
          "label": "Sees the top results in under a second"
        },
        {
          "id": "q10",
          "kind": "decision",
          "lane": "you",
          "next": [
            {
              "to": "q11",
              "label": "Yes"
            },
            {
              "to": "q4",
              "label": "No"
            }
          ],
          "uses": [],
          "label": "Does the first result answer it?"
        },
        {
          "id": "q11",
          "kind": "end",
          "lane": "sites",
          "next": [],
          "uses": [],
          "label": "The site gets the visit"
        }
      ],
      "title": "How a Google search finds and ranks an answer",
      "parent": null
    }
  }
}
```
