What you actually search

When you search Google or Bing, you are not searching the internet. You are searching a copy of it that the search engine built in advance and keeps on its own machines. The live web is far too big and too slow to scan on demand - so the engine does the hard work ahead of time and answers your query from a prepared library.

That library is called an index, and building it is most of the job. A search engine does three things, and only the last one happens while you wait:

  • Crawling - programs called crawlers roam the web, following links and fetching pages, so the engine knows what exists.
  • Indexing - each fetched page is broken down and stored in a structure built for fast lookup by word.
  • Ranking - when you search, the engine finds every page in the index that matches and decides what order to show them in.

Crawling and indexing run continuously in the background, long before you type anything. Ranking is the only step that happens in the half-second after you press Enter. Keep that split in mind - it explains almost everything about how search behaves.

Crawling: finding the pages

A crawler (also called a spider or bot - Google's is Googlebot) is a program that downloads a web page, reads the links on it, and adds those links to a list of pages to visit next. Start it on a handful of known pages, let it follow every link it finds, and it will slowly walk across most of the connected web.

Two things help crawlers do this efficiently instead of guessing:

  • Sitemaps - a file a site publishes that lists its important pages, so the crawler does not have to discover them all by following links.
  • Links - every link from a page the crawler already knows is a hint that another page exists. A page nothing links to is hard for a crawler to ever find.

Sites also control what crawlers may fetch, using a file at the root of the site called robots.txt. It is a plain-text set of rules a well-behaved crawler reads before it visits anything:

# https://example.com/robots.txt
User-agent: *
Disallow: /admin/          # don't crawl the admin area
Allow: /

Sitemap: https://example.com/sitemap.xml

One honest caveat: robots.txt is a request, not a lock. Reputable engines obey it; it is not a security measure, and it does not hide a page from anyone who visits the URL directly. It only tells cooperating crawlers where not to go.

Indexing: the inverted index

Once a page is fetched, the engine cannot just keep the raw HTML and search through all of it every time - reading billions of full pages per query would take hours. Instead it flips the data around into a structure called an inverted index.

A normal index maps a page to the words on it. An inverted index maps the other way: each word points to the list of pages that contain it. Say the engine has crawled three tiny pages:

page 1: "how search works"
page 2: "how the web works"
page 3: "search engine internals"

The inverted index built from them looks like this - one entry per word, each listing the pages it appears on:

"how"     → [1, 2]
"search"  → [1, 3]
"works"   → [1, 2]
"web"     → [2]
"engine"  → [3]

Now a search for search works is fast: look up "search" → pages 1 and 3, look up "works" → pages 1 and 2, and the page in both lists is page 1. No page was re-read; the engine only intersected two short lists. Real indexes store far more - where each word sits on the page, whether it is in the title, how often it appears - but the shape is exactly this.

Understanding the query

Your query gets the same treatment a page does before it touches the index. The engine tokenizes it (splits it into words), lowercases it, and often reduces words to a common root so that running and run match the same entries. Very common words like the and of carry little meaning and are largely ignored.

Modern engines go a step further and try to read intent. A search for python could mean the language or the animal; the words around it, and what most people who typed it went on to click, help the engine guess. It also expands queries with synonyms - a search for car can match a page that only says automobile. This is where a plain word-match engine ends and a modern one begins, but the foundation underneath is still the inverted-index lookup from the last section. The full story of this step - intent, synonyms, and the move to matching meaning rather than words - is Query understanding.

Ranking: choosing the order

Thousands of pages usually match a query. The value of a search engine is not finding matches - it is putting the right ten at the top. To do that it scores every matching page against a large set of signals and sorts by the total. The signals fall into a few families:

  • Text relevance - does the query appear in the title, the headings, the body? A word in the title counts for more than the same word buried in a footer. A word that is rare across the web counts for more than a common one.
  • Authority - how many other pages link to this one, and how trusted are those pages? This is the idea behind Google's original PageRank: a link is a vote, and votes from trusted pages are worth more.
  • Freshness - for a query about news or a live event, a page from today beats one from three years ago. For a query about a stable topic, age barely matters.
  • Quality and usability - does the page load fast, work on a phone, and avoid deceptive layouts? Signals like these break ties between pages that are otherwise close.

No single signal decides the order, and the exact recipe is secret and constantly changing. The tradeoff worth naming: an engine tuned hard for freshness surfaces news well but churns stable results; one tuned hard for authority is stable but slow to reward good new pages. Ranking is the ongoing balancing act between those pulls.

The results page

What comes back is the ranked list, rendered as the page you know - the search engine results page, or SERP. Each result is a snippet: a title, the URL, and a short extract with your query terms shown in context, so you can judge whether the page answers you before clicking.

Around the plain links sit SERP features - a direct answer box, a map, images, related questions. These are the engine deciding that for this query, a link is not the fastest way to help. Some of these features a site earns deliberately, with the structured data markup covered later in the series. Under all of it, though, the core output is the same: a relevance-ordered list drawn from the index.

Why it feels instant

The half-second response makes sense once you remember the split from the start. The expensive work - crawling billions of pages and building the index - already happened. Your query only has to do the cheap part: look words up in a structure built for exactly that.

Speed also comes from spreading the work out. The index is far too large for one machine, so it is sharded - split across thousands of servers, each holding a slice. A query fans out to all of them at once, each returns its best local matches, and the results are merged and ranked. You wait for the slowest shard, not for the whole web. That is how a search of billions of pages returns before you have lifted your finger off Enter.

If you build for the web

Understanding the pipeline changes how you think about your own pages. If a crawler cannot reach a page - nothing links to it, or robots.txt blocks it - it will never be indexed, and a page that is not in the index cannot appear in any result, no matter how good it is. Being findable is step zero.

From there, the ranking signals are a to-do list in disguise: a clear title, real headings, content that matches what people actually search, pages that other sites choose to link to, and a site that loads fast on a phone. None of it is a trick - it is the same work that makes a page good for a reader.

This is the first article in a short series on how search and the web fit together. The next ones go one level down into the pieces named here: robots.txt and sitemaps, the files that steer a crawler; SEO basics, the work that makes a page rank; What is UTM?, the tags that measure the traffic search sends you; and What is a URL?, the vocabulary underneath all of them. The full reading order lives in the Internet search 2026 map.