Skip to main content
Information Retrieval

Web Search Challenges, Size Estimation, Near Duplicates and Crawling

Published: 2026-09-13
Level: undergraduate
Audience: Undergraduate students studying Information Retrieval

Prerequisite Knowledge

This lecture builds on the following concepts from earlier lectures. If any feel unfamiliar, review the linked notes before proceeding.

Previously Covered in This Subject

  • How a retrieval system runs from raw document to ranked output — covered in Lecture 1
  • The inverted index: from words to posting lists — covered in Lecture 2
  • Term weights with TF-IDF and cosine similarity for ranking — covered in Lecture 2
  • Ranked evaluation with precision, average precision, and graded relevance — covered in Lecture 9
  • Why web search is harder than classical retrieval — covered in Lecture 11
  • Search engine parts and differences from classical systems — covered in Lecture 11
  • Static web graph and user behaviour — covered in Lecture 11

12.1 Web Search Stages and Content Challenges

12.1.1 Three Stage Pipeline of Fetch Index and Query

Why does a web query return in a fraction of a second when the web holds billions of pages? The answer is that almost all the heavy work happens before the user types anything.

A web search engine (a system that finds pages matching a user need) works in three broad stages: crawl, index, and answer queries. The crawler fetches pages, the indexer organizes them, and the query stage retrieves and ranks matches.

Think of a library that prepares for visitors overnight. Librarians fetch new books from publishers (crawl), file index cards by every important word (index), and only then answer a visitor who asks for a book (query). The visitor sees only the last step, but the first two steps decide what can be found at all. The analogy breaks at one point: library books arrive neatly catalogued, while web pages arrive messy, duplicated, and sometimes hostile.

Crawling (automatic fetching of pages through a program that follows links) comes first. A crawler (the program that visits pages, downloads content, and hands pages over for parsing and indexing) starts from a few known pages, follows outgoing links, downloads what it finds, and repeats the loop. Indexing (storing posting lists and page data so queries run fast) works like the index at the back of a book. For each word it stores the list of pages that hold it, called a posting list (the list of document identifiers for one term, for example all pages with the word "crawler"). At query time the engine looks up posting lists instead of re-reading the web, so answers come back in a very short duration. The query stage then retrieves candidates and ranks them for the user need.

The same three stages appear in large commercial engines and in small course projects built with Streamlit, web crawl, pre-processing, and recommendation parts joined into one product. A student team can build a tiny engine with the same shape: a fetch script, a small inverted index, and a ranking page.

Exam note: Name the three stages in order — crawl, index, query — and state what each one hands to the next. Crawling hands raw pages, indexing hands posting lists, and the query stage hands a ranked list.

12.1.2 Static Content and Dynamic Content

Not every page sits on the web waiting to be picked up. Some pages are printed in advance, and some are cooked only after the visitor orders.

Static content (a fixed page stored on a server, the same for every visitor) causes little trouble for a crawler. The crawler contacts the application server, browses the page, and brings the content back. Dynamic content (a page built on demand after a user submits a request) is hard, because there is no fixed file to fetch.

Flight ticket booking pages and railway booking pages are the running examples. The exact list of flights, seats, and prices does not sit as a fixed file. It is built after the user enters source, destination, and date. A crawler that visits the booking site without entering any details sees only an empty form, not the thousands of route pages hidden behind it. The open problem is how a crawler can pick the most relevant pages from such request-driven sites and pass useful pages to the indexer. Which source-destination pairs should it try? How many dates? Each guess costs a fetch, and the combinations are endless.

Picture a chart with number of possible form inputs on the horizontal axis and number of pages the crawler must fetch on the vertical axis. For static sites the curve stays nearly flat: one fetch per page. For dynamic sites the curve shoots up steeply, because each new input value multiplies the pages behind the form. The takeaway is that dynamic sites turn a linear fetch job into a combinatorial one.

Scope: Static-page methods in this lecture assume one URL holds one fixed page. That assumption fails for dynamic pages, where one URL plus different form inputs can yield thousands of different results. Assumption: When size is estimated later, only static pages count, because dynamic pages have no fixed total to count.

Common traps: treating a booking form page as if it were the booking result, and assuming that fetching the form equals indexing the inventory behind it. A form fetch gives almost no searchable content.

One-line recap: static pages can be fetched as stored, while dynamic pages must be triggered by inputs, which is why crawlers struggle to cover them. That gap leads straight to the next challenge, because even the pages a crawler does fetch may not be in one language.

12.1.3 Multilingual Content and Interface Support

Queries do not always come in one language, and neither do pages.

About 90 percent of web users know English, but the rest cannot be ignored. A user may write a query in Japanese or Chinese and still expect a match returned in English. The reverse also happens. A user may write a query in English and expect a French document because the query concerns French philosophy or history. Supporting multilingual pages and a multilingual interface is a major challenge. The engine must match across languages and present results in a form the user can read.

Cross-language matching (retrieving documents written in a different language from the query) needs more than word overlap. The Japanese word for train and the English word train share no letters, yet they point to the same idea. A plain posting-list lookup misses that link unless the engine adds translation, shared concept codes, or learned multilingual representations.

Think of a post office that must deliver letters written in many scripts. Sorting by stamp shape alone fails; clerks need a shared address book that maps each local name to one canonical destination. The shared address book is the multilingual vocabulary or translation layer. The analogy breaks where meaning shifts with culture: one query string can mean different things to different readers, so translation alone does not settle ranking.

Beginners often assume English-only indexing plus a translate button solves the problem. It does not. Translation must happen before matching, not only at display time, or relevant foreign pages never enter the candidate set at all.

A multilingual engine must do two jobs: match across languages at retrieval time and render answers the user can read at display time. Missing either job loses a large share of users.

12.1.4 Duplicate and Low Quality Content

The web holds many identical and near identical pages. They arise as mirrors, copied content, repeated URLs, and auto-generated pages. Some near duplicates are made on purpose to attract traffic. Some happen by accident when many sites cover the same domain with similar words.

Removing or grouping duplicates improves diversity of results. Two trending news stories were used as running examples, a court related news item and a hunger strike story. A search on either topic returns many documents with almost identical information. Showing all of them as top ranked results would waste result slots. The engine must spot exact copies and near copies and keep only a diverse set.

Imagine a result page as a shelf with ten slots. If eight slots hold the same news wire copy with different headlines, the user gets two useful choices instead of ten. A diversity filter that keeps one copy and drops the rest hands back eight fresh choices. The horizontal axis of the mental picture is rank position from 1 to 10 and the vertical axis is new information per slot; without dedup the curve drops to near zero after position 2, while with dedup it stays high much longer.

Duplicates (pages identical in syntax and meaning) and near duplicates (pages almost identical except for dates, ads, or small edits) must be grouped before ranking, or result diversity collapses.

Exam note: Duplicate handling returns later in size estimation and in near duplicate detection, so keep the link between diversity and ranking in mind. Size counts use the cleaned static set after duplicates are removed, and ranking quality depends on showing one copy instead of ten.

12.1.5 Spam Techniques That Distort Ranking

Spam (manipulative methods used to push a chosen document higher while bypassing the ranking algorithm) attacks the signals rankers trust.

Common tricks were listed one by one. Keyword stuffing (repeating a buzzing keyword far more times than needed) exploits the fact that term frequency carries weight in rankings such as TF-IDF. An example was a page that repeats model names or exam related keywords only to catch traffic. Hidden text (keywords written in the same color as the background or in hidden styles) shows words to the ranker that users never see. Doorway pages (pages built for one catchy keyword that redirect the visitor to a different site) steal clicks on one promise and deliver another. The phrase easy money was the class example. A user who never looked for easy money clicks the catchy phrase and lands on an instant loan page. Lander pages (bright thumbnails or colored buttons that pull a click and drop the user somewhere never intended) work the same way on video sites.

Instant loan apps were discussed at length, with fast payout followed by high interest and harsh recovery pressure, and with victim stories appearing in daily news. Video thumbnails and colored click buttons show how attention grabbing design feeds lander page traffic. Each trick maps to one abused signal: stuffing abuses term frequency, hidden text abuses index text, doorway pages abuse query match, and lander pages abuse click behavior.

Modern engines use spam detectors and penalty methods, yet spam remains a challenge even for large engines. Detection is a moving target because each new ranking signal invites a new trick that mimics it.

Do not confuse spam with near duplicates. Duplicates copy content and waste slots by accident or by mirroring, while spam copies ranking signals on purpose to climb higher. The fixes differ: dedup groups copies, while spam detection demotes or bans the offender.

Picture detection as a filter between indexing and ranking: pages enter with raw scores, the spam detector lowers or zeroes the scores of manipulative pages, and only then does the final order get fixed. The takeaway is that ranking quality needs both filters — dedup for diversity and spam control for honesty.

For revision, pair each spam type with its abused signal and its visible symptom: stuffing with repeated buzzwords, hidden text with background-colored words, doorway pages with easy money redirects to instant loan sites, and lander pages with bait thumbnails.

12.1.6 Student Questions and Answers

Q: What is crawling in a web search engine?

A: Crawling is the automated first stage that fetches pages from the web, follows links, downloads content, and passes pages to indexing and parsing. Indexing then supports fast retrieval at query time. The crawler hands over many pages and URLs, but the parsed and stored index entries are what later stages can search, so crawl count and index count are not the same thing.

12.2 Estimating the Size of a Web Search Engine

12.2.1 What Size Means and Why Index Size Matters

Bigger should mean better, not just more junk pages. That single sentence sets the whole measurement goal: a size number is useful only if it tracks useful coverage.

Several counts could define size — number of websites, number of web pages, number of deep web pages, and storage in terabytes — but each gives a different answer. A few servers are rarely connected. A laptop is a server in a technical sense but should not be counted as part of the searchable web. Dynamic pages also distort the count because they are built on demand.

Think of counting books in a library versus counting pages versus counting shelf meters. Each number is correct on its own terms, yet none of them alone tells which library serves readers better. The size debate for search engines has the same shape: pick the unit that tracks what users actually get.

The sensible target is the static web after duplicates are removed. For fair comparison between two engines, the agreed measure is estimated index size on that cleaned static set. A crawler may fetch many URLs, but the count of parsed and stored index entries is the fair measure of coverage.

An early class exchange fixed this idea: crawler page count looks impressive, but index count is the right size signal, because only parsed and stored entries can answer queries.

The class also raised a scoping rule for a page. Storing only the first 4000 bytes of a page is not full indexing. Anchor text alone once described billions of pages in past systems, but anchor text alone is not enough in the present age. The engine must store and process page content itself. A page that is only half stored is only half searchable.

Scope: All size methods in this lecture assume the cleaned static set — static pages only, duplicates removed, rarely connected servers and personal devices left out. Assumption: Each engine is treated as holding an independent, uniformly picked subset of that finite web, even though real crawling is far from uniform. Later methods inherit this shaky but necessary assumption.

When asked what size means, answer in two lines: size means estimated index size on the cleaned static set, and index count beats crawler count because only indexed pages can be retrieved.

12.2.2 Why Counting Domain Names Fails

One idea is to count domain name server registers, since those registers hold domain names. In words the idea was described as go and count the registers in engine one and engine two and call the larger one bigger. This fails.

Not every domain hosts a website, so the register count overstates the web. One domain can also host many distinct sites — think of university subdomains or hosted blogs — so the same count understates it elsewhere. Both errors strike at once, and there is no fixed correction factor. Counting registers is so not a sound size measure.

A tiny case shows the flaw. Suppose engine one covers 100 domains that each hold 1 site, while engine two covers 10 domains that each hold 50 sites. Register counts say engine one is ten times bigger, while true site counts say engine two is five times bigger. The register proxy points the wrong way, which is why the lecture drops it and moves to sampling.

12.2.3 IP Address Sampling With Fractions

A second idea is to count IP addresses by brute force. Compared with counting domain names it makes a little more sense, because an IP address is closer to a real machine than a name entry is. But counting every address by hand is tiring and not feasible at web scale. Dynamic addresses add more trouble, since the same machine can wear different addresses over time. Even if thought is restricted to static addresses only, full counting does not scale. This is where sampling helps. Take a subset and generalize to the whole, the same idea used in data pre-processing when data is too large to handle in full.

Picture the sampling setup as two circles. The large blue circle is the universe of IP addresses and the small yellow circle is the sampled subset drawn from it. Check each sampled address for a valid web server that returns a valid page.

Let be the number of sampled addresses and let be the number of sampled addresses that host valid sites. The verbal description in class was fraction of sample that hosts valid websites, V out of S. The IP sampling fraction of valid sites scaled to whole universe is:

where is a unit free fraction in the range 0 to 1, is a count of valid sampled sites, and is a count of sampled addresses. The estimated valid count in the whole universe with addresses is then:

where is the total address count and is the estimated count of valid sites. Do the same for the second engine and compare the two estimates.

A concrete pass makes the arithmetic visible. Sample addresses, find valid servers, so . If the universe holds million addresses, the estimate is valid sites. The sense-check is direct: about 8 in every 100 sampled addresses answered, so about 8 percent of the universe should answer too, as long as the sample was fair.

In theory this gives a defensible magnitude. In practice it is biased because many sites share one IP address through virtual hosting, and one site can span many IP addresses. Shared hosting hides many sites behind one address, while replicated hosting spreads one site over many addresses, so the same fraction idea can both miss and double count. The same fraction idea can be moved from site level to URL level by taking the fraction of sampled URLs that are valid and using it to estimate page counts.

Scope: IP sampling assumes one address maps to about one server. Virtual hosting breaks that mapping badly on the modern web. Assumption: The sampled addresses are picked uniformly at random and each is tested the same way; any skew in picking or testing flows straight into .

Worked sketch: With and , . For million, million. If engine one indexes 1.5 million of those and engine two indexes 1.8 million, engine two covers more of the valid web even though both drew from the same universe.

IP sampling trades exact counting for a cheap fraction: measure out of on a small sample, scale by , and compare engines on the scaled numbers while remembering the virtual-hosting bias.

12.2.4 Static Web Scope and Student Questions and Answers

Size talk must fix scope first. Count static pages only, remove duplicates, and then estimate. Dynamic pages, rarely connected servers, and personal devices are left out. Every later sampling method in this lecture inherits that scope.

Q: Is crawler page count or index count the right size signal, with crawled pages as the signal?

A: Index count is the right signal. The crawler hands over many pages and URLs, but the parsed and stored index entries are the fair measure of coverage, because only indexed pages can answer a query.

Q: Can we count domain registers to compare two engines?

A: No. Not every domain hosts a website and one domain can host many distinct sites, so register counts mislead. The domain idea fails before sampling even starts.

Q: Can we count all IP addresses for each engine, given dynamic addresses?

A: Counting all addresses is not feasible, and dynamic addresses make it worse. Even restricted to static addresses it is too tiring at web scale, so sampling and generalization are needed. That is why the lecture moves from full counting to the domain rejection and then to IP sampling fractions.

12.3 Capture Recapture for Relative Index Size

12.3.1 Method Borrowed From Field Counts and Overlap Equation

How do biologists count fish they cannot see? They catch a few, tag them, release them, catch again, and read the share of tagged fish in the second catch. That share reveals the lake total without draining the lake.

The capture recapture method was first used to estimate fish in a lake. The same thought applies to the web, which was likened to an ocean. Take a sample from engine one. From that sample pick a random subset and test how many of those pages also appear in engine two. Then reverse the direction. Sample from engine two, test overlap in engine one, and equate the two overlap shares.

Think of two overlapping fishing nets thrown into the same ocean. Each net catches its own share of marked fish, and the overlap between the catches tells how big each net is relative to the other. The fish-to-web mapping is direct: tagged fish are pages indexed by one engine, and recaptured fish are pages found in the other engine too. The analogy breaks where engines are not random nets: real engines favor popular, linked, and fresh pages, so their catches are skewed in similar ways.

The verbal form given in class was X percent of engine one is equal to Y percent of engine two. With for index size of engine one, for index size of engine two, for overlap share seen from engine one side, and for overlap share seen from engine two side, the capture recapture overlap shares equating engine sizes give:

where and are fractions between 0 and 1. If one engine size is known, the other follows as . Even when neither absolute size is known, the ratio by gives relative size, how much bigger or smaller one engine is than the other.

Why does equating work? The overlapping pages are one fixed set counted from two sides. From engine one's side they form share of ; from engine two's side they form share of . Both products estimate the same overlap count, so they must match. Dividing both sides by and by gives the handy ratio form:

so a larger relative to means engine one is larger relative to engine two.

Scope: The equation assumes each engine holds an independent, uniformly picked slice of a fixed web. Real engines violate this because crawling favors linked and popular pages. Assumption: Samples are random and presence tests are correct; biased sampling or broken presence checks (timeouts, blocking) distort and directly.

Remember the fish lake analogy that motivates the web ocean overlap shares: overlap shares reveal relative size without full counting, through .

12.3.2 Numeric Worked Example With 60 Percent and 40 Percent

Setup with sixty forty overlap shares solving thousand to fifteen hundred pages: sample 4000 pages from engine one, then randomly select 100 functioning pages from that sample. Check how many of the 100 also appear in engine two. Suppose 60 of the 100 appear there. That is an overlap share of 0.6 from engine one side. Then sample engine two in the same way, pick 100 random pages, and check presence in engine one. Suppose about 40 percent appear there. That is an overlap share of 0.4 from engine two side.

Substitution into the overlap relation gives:

where and are index sizes as defined above. Now fix a concrete size for engine one to see the arithmetic. Let pages. Then the left side is:

Set 600 equal to the right side:

Solve for :

The result is 1500 pages in engine two. Engine two is 1.5 times engine one in this hypothetical run. Sense-check: engine one's overlap share is higher (0.6 versus 0.4), so engine one must be smaller, because the same overlap forms a bigger share of a smaller index. The steps were stressed as sample first, then random subset, then cross check overlap, then equate shares, then solve.

A second sense-check uses the ratio form: , so , which matches the 1000 to 1500 result. If instead both shares were equal, the engines would be judged equal in size.

12.3.3 Pictorial Grid Example With 4 Cells and 12 Cells

A small picture made the same point without large numbers. Universe A has 4 cells. The overlap A intersect B covers 2 of those 4 cells. The verbal share was 2 out of 4. The grid pictorial overlap half against sixth giving triple size starts here:

where is cell count of universe A and is shared cell count. Universe B is a 3 by 4 grid with 12 cells. The four cell against twelve cell grids comparison continues: the overlap there is 2 cells. The share is 2 out of 12:

where is cell count of universe B. Equate the two scaled sizes:

Multiply both sides by 6 to solve:

So B is thrice as large as A. The picture and the fish count share one logic. Overlap shares reveal relative size.

Picture the drawing: a small 2 by 2 square for A with 2 shaded cells, next to a 3 by 4 rectangle for B with the same 2 shaded cells tucked in one corner. The horizontal axis is just cell position and the vertical axis is membership, but the visual punch is the density of shading: half of A is shaded while only a sixth of B is, so B must hold three times the cells to host the same overlap. That density contrast is the whole method in one glance.

Both worked examples run the same five moves: sample, random subset, cross check overlap, equate shares, solve. The numbers change; the logic does not.

12.3.4 Student Questions and Answers

Q: Can we do the overlap comparison between two engines in practice?

A: Yes. Sample pages from each engine, pick random subsets, measure cross presence in the other engine, and equate the overlap shares to get relative size. The capture recapture overlap shares give the ratio even when neither absolute index size is known.

12.4 Query Based Sampling

12.4.1 Random Queries Built From Rare Terms

Sampling still leaves one open choice. How is the random sample drawn? Four procedures were compared. Two use queries and two avoid queries. Random queries are the first query based method.

The idea is simple. Come up with one or two queries, apply the same conjunctive query in both engines, collect returned URLs, randomly pick about 100 URLs, and measure how many appear in the other engine. From that overlap share and a known size on one side, estimate the other side. The ratio alone already shows relative size.

Term choice matters. Rare terms were used in the class example, vocalist and RSI. The query was a conjunction of word one and word two, in words word one and word two. Rare terms keep result sets small enough to handle: a common word returns millions of hits that cannot be checked by hand, while a rare conjunction returns a short list that can. The procedure does not count every page directly. It uses query driven random results to estimate overlap and then index size.

Think of fishing with a very specific bait that only a few fish bite. The catch is small, so it can be counted fully, and the tagged share inside it still reveals the lake. The analogy breaks where bait choice skews the catch: rare-term bait only samples pages that hold those rare terms, which is exactly the query bias discussed below.

Scope: Random-query sampling assumes a rare-term query draws an almost uniform page from the index. Real engines rank, cut off, and mishandle long conjunctions, so the draw is only roughly random. Assumption: The same query means the same thing in both engines; different stemming, stop-word, or AND handling breaks comparability.

12.4.2 Random Search Drawn From User Logs

Random search is the second query based method. Instead of inventing a query, take a query from the user log. All interaction data is logged, so pick a logged query, run it on engine one and engine two, keep only queries with a small result set, and compute the overlap ratio.

Because the queries are real, they reflect actual human search patterns. A made up conjunction such as vocalist and RSI looks nothing like a normal human need, while logged queries mirror what users type. That match to lived use is the main strength of this method. A query log is a diary of what people truly asked, so sampling from it samples real demand rather than an inventor's guess.

Picture two bars side by side: invented queries cluster around rare dictionary words, while log queries cluster around popular names, shopping, and current events. The horizontal axis is query popularity and the vertical axis is share of samples. The takeaway is that the two methods probe different corners of the index, so their overlap numbers can disagree even on the same engine pair.

Use log queries when the goal is to compare engines on traffic that matters to users; use invented rare-term queries when the goal is a controlled probe with small, checkable result sets.

12.4.3 Biases and Limits of Query Methods

Both query methods are statistically neat but carry biases.

Query bias favors content rich pages in the lexicon languages used to build the seed queries. Ranking bias enters through the seed conjunctive queries and through engine ranking behavior. A long conjunctive query with about eight AND terms may be mishandled by an engine. Checking rules, duplicate handling, and result cutoffs add more distortion. Malicious bias is possible when an engine sabotages a test probe, for example by detecting the probe terms and answering differently. Operational problems include timeouts and failures on heavy AND queries.

Random search adds its own limits. Samples correlate with the source log, so they inherit log skew toward popular topics and one language community. Duplicates have high chance because of repeated popular queries asking the same thing many times. Queries must have non zero results in both engines. A zero result query breaks the overlap math because shares cannot be formed from empty sets. Neither method is good or bad in isolation. Each has trade offs, which is why the lecture keeps all four sampling designs on the table before recommending.

Dimension Random queries (invented) Random search (log based)
Query source Invented rare terms such as vocalist and RSI Real user log queries
Strength Small, checkable result sets Mirrors real human needs
Main bias Query and ranking bias from seed terms Log skew and duplicate risk
Fails when Engine mishandles long AND queries or times out Query has zero results in either engine

Pick invented queries for a controlled experiment and log queries for a user-weighted comparison; report which one was used, because the numbers are not interchangeable.

Query methods reuse the same overlap math as capture recapture; their novelty is only in how the sample is drawn, and each drawing rule brings its own bias.

12.4.4 Student Questions and Answers

Q: Can you show a numerical problem demonstrating the overlap calculation step by step?

A: The core numbers stay the same across methods. Once samples give overlap shares, equate the shares and solve. The overlap math is the same; the open issue taught here is how the sample is drawn, first by invented query and next by log query, and only then does overlap math apply.

Q: For log based sampling do we create the query or take it from the log?

A: Take it from the log for the second method and create it for the first method. After URLs are picked and intersections are taken, the rest is overlap estimation: measure cross presence, form the two shares, and solve for relative or absolute size.

12.5 Sampling Without Queries

12.5.1 Random IP Address Sampling Step by Step

Random IP sampling avoids queries and samples the web itself instead of sampling through an engine's ranker. That independence is its whole appeal.

The steps were spelled out as a repeatable loop. Generate a random IP address. Check whether a web server answers at that address. If it answers, collect all pages on that server. From those pages pick one page at random. That is one sampled page. Repeat the loop about 100 times to get 100 random pages. Then do the familiar cross check. Measure presence of engine one sample in engine two and vice versa, call the shares X and Y, and use X by Y for the ratio or for absolute estimation when one size is known.

Think of throwing darts at a wall map where each dart picks a street address, then knocking on the door and interviewing one resident. The dart throw (random IP address) does not depend on any guidebook's recommendations, so the sample escapes the guidebook's taste. The analogy breaks where buildings differ wildly: a dart that hits a tower block (a host with thousands of pages) and a dart that hits a hut (a host with one page) get equal weight at the address step, which skews page chances unless corrected.

This path looks clean in theory. It is statistically sound and independent of crawling strategy because pages are picked across hosts rather than through engine ranking. One noted limit is duplicate handling. If the working scope is already static pages with duplicates removed, this limit matters less. The larger limit is hosting reality. Many hosts share one IP through virtual hosting or refuse requests, so some sites are missed, over counted, or under counted. There is also no promise that all pages link back to a root page. A company site may hold employee pages with no direct link from the home page, so host level collection can miss them. Even with these limits, this method was ranked as the preferred choice among the first three studied, because its biases are better understood than query and ranking biases.

Scope: The loop assumes each random address can be tested fairly and each host's pages can be listed. Firewalls, virtual hosting, and hidden unlinked pages break that assumption. Assumption: One page picked per answering host keeps large hosts from dominating; without that rule, big sites would flood the sample.

Random IP address sampling is the preferred query-free baseline: loop over random addresses, keep one page per answering host, and feed the sample into the standard overlap ratio.

Random walk sampling uses network science instead of address throws. View the web as a directed node graph where each page is a node and each link is a directed edge.

A random surfer follows links, with care to return and to avoid spider traps that trap a crawler in loops. Follow random walks or frequent walk paths, collect visited links, and sample from the stationary distribution to get sample pages. Do this for engine one and engine two and estimate overlap as before.

Picture a board game where the next square depends only on the current one: from each page, roll a die over its outgoing links and step to the winner, sometimes teleporting back to a fresh start to escape loops. After many steps the share of visits to each page settles into a steady pattern called the stationary distribution (the long-run visit shares of the walk, with one number per page). Pages visited more often in that steady pattern are sampled more often. When the directed graph for each engine is available, this method is statistically very clean and can even work on an endless web, because the walk never needs the full address list up front.

Practical limits remain. Seed nodes must be chosen, and a bad seed set traps the early walk in one corner. Approximations may not hold, because the real web is not strongly connected and the walk may never settle. Real world graphs have non uniform distributions, so frequent paths or loops can skew the sample toward hubs that every path crosses.

Do not confuse the walk's visit shares with uniform shares. A walk oversamples well-linked pages by design, so raw walk counts must be corrected before they can stand in for uniform draws in the overlap equation.

One-line recap: the random walk trades the address book for the link graph, gaining freedom from queries at the price of graph skew and seed dependence.

12.5.3 Comparison and Choice

Four methods were placed side by side. Random queries are easy to build but carry query and ranking bias. Random search reflects real use but inherits log skew and duplicate risk. Random IP sampling is clean and independent of rankers but struggles with shared IPs and unlinked pages. Random walk sampling is elegant on graphs but needs graph data and care with seeds and skew.

Method Needs queries? Core move Biggest risk
Random queries Yes, invented rare terms Same conjunction in both engines, pick ~100 URLs Query and ranking bias
Random search Yes, from user logs Real logged query, small result set, overlap ratio Log skew, duplicate queries
Random IP address No Random address loop, one page per host Virtual hosting, refused requests
Random walk No Walk the directed graph, sample steady visits Seed choice, non uniform graph, traps

The reason for all four is one shared goal. Estimate index size so engines can be compared as bigger or better on cleaned static coverage. For revision, memorize the methods as two pairs: query based methods differ in where the query comes from, and query-free methods differ in whether they throw address darts or walk the graph.

If forced to pick one without query access, pick random IP address sampling; if the link graph is at hand and seeds can be chosen with care, the random walk is the elegant alternative. Both feed the same overlap equation from the previous section.

12.6 Near Duplicate Detection With Shingles and Sketches

12.6.1 Exact Duplicates by Hash Fingerprints

Why does a highly relevant page suddenly look useless? Put it just below its twin and the user gains nothing from the second copy.

Exact duplicates (pages that match dot to dot in syntax and meaning) are easy. Pick a hash function, build a fingerprint (a short number summarizing a document, such that equal documents give equal numbers) for each document, and compare fingerprints. The class used a toy hash described in words as X mod something, applied to document text to get a fingerprint number. When two fingerprints match exactly, one copy can be dropped.

Think of fingerprints as luggage tags: two identical suitcases get identical tags, so baggage handlers can spot the pair without opening either case. The tag check is fast because number comparison is easier than word comparison. The analogy breaks for near copies: two suitcases with one swapped shirt get different tags even though they are almost the same, which is why exact fingerprints cannot catch near duplicates.

The hard part is near duplicates. A highly relevant document turns non relevant for a user if it appears just below a near identical copy. The web holds a huge count of such near copies, so near duplicate removal is a central ranking quality step. Dedup protects both size counts (the cleaned static set) and result diversity (ten slots should not hold one story ten times).

Exact match is a fingerprint equality test; everything after this subsection upgrades that test to near match.

12.6.2 Shingles as Word N Grams and Jaccard Similarity

A shingle (a consecutive word n gram used as one set element) turns a document into a set. The sentence a rose is a rose is a rose was shingled with 4 word windows to show the idea. The four shingles are a rose is a, rose is a rose, is a rose is, and a rose is a. Each document then becomes a set of shingles, with repeats kept only once at the set level.

Similarity between two shingle sets uses Jaccard similarity. In words it was described as ratio of common words to the whole universe of words, A intersect B by A union B. The Jaccard similarity of shingle sets as intersection over universe is:

where and are shingle sets, is the count of shared shingles, and is the count of distinct shingles across both documents. A score of 0 means not similar. A score of 1 means similar. A threshold must be fixed for near duplicate calls, for example 80 percent, 70 percent, or 60 percent, based on content type and task. A 100 percent match is not required because the goal is near copies. Reference texts often quote 0.9 as a strict default, while this lecture varies the cut by task; keep the lecture's task-dependent thresholds for exam answers and note 0.9 as the strict textbook variant.

A tiny Jaccard example used two short documents with four shingle slots. Only the first shingle was shared. With universe A plus B plus C style counting, the shared part was A and the universe was A plus B plus C, so the score was intersection over universe for that toy case. In set terms, one shared shingle out of a larger union gives a low score, so the pair is judged dissimilar.

Cosine on term vectors was raised as a first thought, and it can catch syntactic overlap. It struggles when two pages say the same thing in different words with synonyms swapped. Semantic copies that differ in wording are not treated as near duplicates by this syntactic method. That limit matters for plagiarism checks but keeps the web dedup task tractable: the lecture targets word-level near copies, not paraphrase detection.

Picture Jaccard as two overlapping circles. The horizontal axis is shingle identity and the shaded lens in the middle is the intersection; the score is lens area divided by total inked area. The takeaway is that shared material counts only relative to everything either document holds.

Scope: Shingle Jaccard judges syntactic overlap of word windows, not meaning. Two pages with the same facts in fresh words score low and are kept as separate results. Assumption: Shingle sets are built the same way for both documents — same window size, same tokenization — or the sets are not comparable.

Shingles turn near-copy detection into set overlap, and Jaccard turns overlap into a number between 0 and 1 ready for a threshold call.

12.6.3 Sketches Hashing Permutation and Minimum Values

Shingle vocabularies grow huge even with 2 gram or 4 gram windows, so full set comparison is too heavy. Comparing every pair of billion-page sets is out of reach. The fix is to keep a small summary called a sketch (a cleverly chosen random subset of shingles that approximates the full set). Sampling again solves a web scale problem. Take sketch A and sketch B and apply the Jaccard measure on sketches to call near duplicates.

Fingerprints make word comparison fast. Convert each shingle to a number with a hash code, because number comparison is easier than word comparison. The hash range zero to power minus one fingerprint mapping is:

where is the hash value and is the bit width. With the range is 0 to 15. With the hash returns a 64 bit value per shingle, one number per shingle drawn from an enormous range so collisions stay rare.

Plot those numbers on a one dimensional number line. Then apply one random permutation of the whole hash space, which reorders every possible hash value into a random order, and read off where each document's values land. From the permuted values keep the minimum value. That minimum is the sketch summary for one round. Repeat for about 100 or 200 independent permutations. Compare minima round by round across the two documents with the same hash and same randomization. When minima match in 60 or 70 of 200 rounds, the same syntactic material recurs in both documents, and one copy can be discarded.

Why does the minimum carry the full overlap signal? In any fixed random ordering, every shingle in the union is equally likely to stand first. The two minima agree exactly when that first union element lies in the intersection. So the match chance over random permutations equals intersection size over union size, which is the Jaccard score:

where and are the per-document minima and , are the shingle sets. The fraction of agreeing rounds over many permutations estimates Jaccard directly.

Think of numbers in a hat, the professor's analogy for the random sketch subset minimum. Five numbered slips in class stand for millions of shingles in real documents. Shake the hat (apply the random permutation), draw the ordering, and keep the smallest number drawn for each document. The sketch is a cleverly chosen random subset, not a hand picked set, and the minimum of that subset is kept. Full hand sorting of millions is not the practical path; one random ordering plus its minimum per round does the same job, because the minimum of a random ordering is itself a uniform draw from the union.

A numerical spot-check confirms the logic. If two documents share 1 shingle out of a 4 shingle union, Jaccard is 0.25, so about 50 of 200 permutation rounds should agree. If they share 3 out of 4, about 150 of 200 rounds should agree. The lecture's 60 to 70 matches out of 200 signals a Jaccard near 0.3 to 0.35, a moderate overlap rather than a near copy at a 0.7 threshold.

Scope: Sketch estimates track syntactic shingle overlap only; paraphrased copies still slip through. Assumption: Both documents use the same hash function and the same permutation in each round. Mixing hashes or permutations between documents voids the comparison.

Hash, permute the full space, keep the minimum, repeat 100 to 200 times, and read the agreement share as Jaccard. That pipeline turns billion-scale comparison into a pocket-sized sketch.

12.6.4 Worked Examples

Cat sentence chain with the cat sat on the mat shingles hashed to minima sketch six: Document text: the cat sat on the mat. Step one is shingling with 2 word windows. The five shingles are the cat, cat sat, sat on, on the, and the mat. Step two is fingerprinting. With the hash is:

where is a shingle and is the base hash. Suppose the hash returns 3 for the cat, 4 for cat sat, 6 for sat on, 11 for on the, and 15 for the mat. These are illustrative outputs, not a real hash. Plot 3, 4, 6, 11, 15 on the number line. This list is the document fingerprint. Step three is permutation and sketching. After random permutation pick a small sample, for example 6 and 11 in the class run. The minimum of that sketch is 6. So one round returns 6 for document one. Repeat the same hash, permutation, and minimum steps on document two for at least 100 or 200 rounds, then compare minima point by point. Matching minima across many rounds signal near duplicates. Sense-check: the minimum must always be one of the document's own hash values, never a value from outside the set.

Five shingle truth table with minwise Jaccard zero for dissimilar documents: Five shingle rows are marked 1 when present and 0 when absent. Document one holds shingle 1, shingle 3, and shingle 4. Document two holds shingle 2, shingle 3, and shingle 5. Two hash functions are fixed before the run, with starting values for X equal 1 through 5:

where is the shingle index from 1 to 5. Iteration one: shingle 1 is in document one only, candidate pair 1, 3 becomes current minimum 1, 3 for document one, while document two stays at infinite. Iteration two: shingle 2 is in document two only, so document one keeps its prior minima and document two takes 2, 0 as first assignment. Iteration three: shingle 3 is in both, candidates 3, 2, so take minima against prior values, giving 1, 2 for document one and 2, 0 for document two. Iteration four: shingle 4 is in document one only with defaults 4, 4, so update document one minima and carry document two forward. Iteration five: shingle 5 is in document two only, so update document two minima and carry document one forward. Final minima are 1, 2 for document one and 0, 0 for document two. Pointwise comparison finds no match, 1 against 0 and 2 against 0, so the Jaccard estimate is 0. The documents are very dissimilar and are not called duplicates.

The three document exercise with fifty percent at a seventy threshold decision extends the same loop. Final vectors were 1, 1 for document one, 0, 0 for document two, and 2, 0 for document three, under the two mod functions. First function finds no common minima between one and two and none between two and three. Second function finds one shared shingle between document two and document three. The Jaccard estimate for document one and two is 0. The estimate for document two and three is 0.5, or 50 percent.

Exam note: With a 70 percent threshold the 50 percent pair is not called near duplicate, but with a lower threshold it could be grouped as duplicate. Always state the threshold before the verdict, because the same 50 percent score passes at a 0.4 cut and fails at a 0.7 cut.

12.6.5 Student Questions and Answers

Q: What is M in the hash range for shingle fingerprints?

A: M is the bit width for numbers. Each shingle is hashed into bits, so values fall in zero to two power M minus one. With M equal 4 the range is zero to fifteen, and with 64 bits each shingle gets a 64 bit output.

Q: When we permute five points, should there be 120 factorial orderings, and are we rearranging all millions of shingles or only a subsample that seems off from the diagram?

A: Think of numbers in a hat. Pick a few at random because five in class stands for millions in real documents. The sketch is a cleverly chosen random subset, not a hand picked set, and the minimum of that subset is kept. Full reordering of millions is not the practical path; random subset plus minimum is the working sketch. Formally each round applies one random permutation of the hash space and keeps the minimum, and the agreement share over 100 to 200 such rounds estimates the Jaccard score.

12.7 Learning to Rank for Web Results

12.7.1 Why Ranking Is More Than Retrieval

For almost any query the web holds a very large number of candidate pages. The real challenge is not just finding matches but ordering them in the right order at scale.

Relevance is not fixed. A page relevant today may not be relevant tomorrow. Relevance also shifts by user. Jaguar can mean a car, an animal, or an operating system, so the same string needs different top results for different needs. A car buyer, a biology student, and a retro computing fan type the same six letters and want three different number-one hits.

Learning to rank (a machine learning method that improves ranking quality so relevant documents rank above less relevant ones for a given need) learns that ordering from data instead of hand tuning it. A published article was shared as reference for this part, with a PDF link for follow up reading.

Till now ranking used plain cosine similarity, TF-IDF, term proximity, in link and out link counts, and the PageRank algorithm. Those signals work, but ranking at web scale is a hard problem, because no single signal orders every query well. The learned approach collects textual match signals and user behavior on past results and outputs one learned rank function ordered by user need. Jaguar is the proof that one fixed order cannot serve all users; the rank function must condition on signals that separate the car need from the animal need.

Picture relevance as a moving target on a timeline: the horizontal axis is days and the vertical axis is the best page for the query. News queries swing daily, while Jaguar swings by user rather than by day. The takeaway is that ranking must adapt to time and to person, which fixed formulas cannot do alone.

Retrieval finds candidates; ranking puts the right one first for this user today. Learning to rank exists because relevance moves.

12.7.2 Pipeline Features and Training Grades

Learning to rank is applied after first level retrieval, not from the start. Scoring billions of pages with a learned model on every query would be far too slow.

The pipeline has three steps. Start with a retrieved candidate set from a fast first pass. Turn that unstructured set into structured features, one numeric row per document. Then rank with a model and display results in order. The ranker scores only the shortlist, not the whole web, which keeps the method practical.

Feature extraction can use BM25, TF-IDF, title match, anchor text match, link based scores, page features such as freshness, quality, and load speed, and user signals such as clicks, turnaround time, and popularity. Many more features can be added when available. Each feature is one column: BM25 says how well words match, PageRank says how trusted the page is by links, title match says whether the query hits the headline, and clicks say what past users chose.

At training and testing time human judgment is needed because no gold data tells right from wrong on its own. Assessors give graded labels on a 5 to 1 scale from perfect to bad, and logged behavior helps validate. Training items can be single documents, pairs, or ranked lists. Single documents lead to pointwise methods, pairs lead to pairwise methods, and ranked lists lead to listwise methods. This session covers pointwise and pairwise only. Listwise is left out.

Think of training as exam marking: pointwise asks the marker to grade each answer alone, pairwise asks which of two answers is better, and listwise asks for the full class order. The lecture practices the first two marking styles on the laptop query.

Scope: The learned ranker only reorders the retrieved shortlist; pages missed by first level retrieval can never be rescued later. Assumption: Graded labels and logged clicks reflect true user need closely enough to train on; noisy or gamed labels train a noisy ranker.

12.7.3 Pointwise Ranking Worked Example

Pointwise ranking (predicting a relevance score or class for each page on its own) treats ranking as ordinary regression or classification, with models such as logistic regression. It is simple but it ignores relative order while scoring: each document is graded alone, and sorting happens only afterward.

Laptop query with pointwise scores 3.9 and 2.2 ordering documents: Query: best laptop for student. Three retrieved documents are unordered at start. Document one text is student laptop guide. Document two text is popular laptop store. Document three text is old general article. By plain sense document one or two should top the list and document three should rank low.

Feature extraction uses three features in class: BM25 score, PageRank score, and title match score. Each document gets three numbers, forming a 3 by 3 matrix with documents as rows and the three features as columns. A scoring function with one weight per feature combines them. The pointwise weighted sum of independent features scoring documents is:

where is a retrieved document, is its pointwise rank score, is the BM25 value, is the PageRank value, is the title match value, and are learned weights. BM25 gets the highest weight, title match gets middle weight, and PageRank gets the least weight in the class setup. This is a linear regression form, though any predictor such as nearest neighbor or support vector machine could take the same matrix as input. Computing scores gives 3.9 for the top document, 2.2 for the next, and the lowest value for the third document. The order matches the plain sense guess. Document three ranks last. Sense-check: the student guide should outscore the old general article on BM25 and title match, so its weighted sum must land on top; if it did not, the weights would be suspect.

The pointwise limit is visible here: the model never compares documents during training, so it can assign close scores to pages users would strictly order. That gap motivates the pairwise upgrade.

12.7.4 Pairwise Ranking Worked Example

Pairwise ranking (learning which of two pages should stand higher) compares two pages at a time. With set D1, D2, D3 the needed pairs are D1 to D2, D1 to D3, and D2 to D3. Only three combinations, not six permutations, because D1 versus D3 and D3 versus D1 carry the same inference in opposite sign. Extra features such as in links, out links, freshness, quality, clicks, and popularity could be added, but the class reused the scores already computed.

Take plain differences of scores. With for pointwise score, the three pairwise score differences ranking D1 D2 D3 in order are:

A positive difference means the first page should display above the second. The class values gave positive gaps from D1 over D2 and D3, and from D2 over D3, so final order is D1 first, D2 next, D3 last. The reverse subtraction changes sign but not inference. D3 minus D1 is about minus 2.9 when D1 scores 3.9, which still says D1 is higher than D3. Pointwise gives absolute labels while pairwise gives pairwise wins that then order the list. Real systems replace plain subtraction with richer math such as probability estimates, but the comparison thought stays the same.

A compact way to read the result: D1 beats both rivals so it ranks one, D2 beats only D3 so it ranks two, and D3 beats none so it ranks three. That win-count reading turns three pair outcomes into one ordered list without any extra model.

Beginners often build all six directed pairs and train twice on the same fact. Three combinations without replacement are enough; the reverse pair is redundant because minus 2.9 still means D1 is greater than D3, so inference does not change.

Pointwise grades papers alone; pairwise stages head-to-head matches and sorts by wins. Both reuse the same BM25, PageRank, and title features.

12.7.5 Models Evaluation and Student Questions and Answers

Many rank learners can sit on the same features, including support vector machines and RankNet style models reviewed in the shared paper. Evaluation reuses known measures: precision at K, mean average precision, mean reciprocal rank, normalized discounted cumulative gain, and precision recall curves. The single goal stays fixed. The most relevant document must come to the top.

Q: In pairwise ranking do we use minimum distance or maximum difference?

A: Use plain difference. If D1 minus D2 is positive then D1 is greater than D2, else D2 is greater than D1. It is high school subtraction: the sign picks the winner.

Q: Why only D1 greater than D2 and not all directed pairs such as D1 greater than D3?

A: All three combos are used, D1 to D2, D1 to D3, and D2 to D3. D1 beats both so D1 ranks one, D2 beats only D3 so D2 ranks two, and D3 beats none so D3 ranks three.

Q: Do we need both D1 minus D3 and D3 minus D1, which would be six ordered pairs?

A: No. Only three combinations without replacement are needed. Both directed pairs would double the work, and six ordered pairs add nothing. The reverse pair is redundant because minus 2.9 still means D1 is greater than D3, so inference does not change.

12.8 Web Crawler Design and Architecture

12.8.1 Must Have Traits Robustness and Politeness

Crawling gathers pages for indexing, so bad crawl choices flow straight into bad search results. The objective is fast and efficient gathering. Two traits are non negotiable.

First is robustness (surviving the hostile and messy web without crashing or looping forever). The crawler must survive spider traps, handle duplicate and near duplicate pages well, work on very large pages, scale to web size, and deal with dynamic pages. Second is politeness (respecting site owners and their stated limits). The crawler must respect site owners. Explicit politeness follows stated crawl rules. The robots exclusion file tells which parts shall be crawled and which shall not, and the crawler must respect those bounds. Implicit politeness holds even with no stated rules. The crawler must not hit one site again and again very often.

Think of a guest who visits many houses in one day. A robust guest keeps walking through rain, locked gates, and maze-like gardens without giving up. A polite guest knocks gently, reads the do-not-enter signs, and never rings the same bell ten times in a minute. The web crawler must be both guests at once. The analogy breaks where scale bites: one polite pause per site is nothing, but a million such pauses need careful scheduling across threads.

An impolite crawler gets blocked, banned, or trapped, which hurts the crawler itself. A blocked address loses all future pages from that host, a ban can spread to sibling crawlers, and a spider trap can burn hours in an endless calendar or session-id maze. Two reminders were stressed together. Support dynamic pages and avoid hitting any site too often.

Robustness keeps the crawler alive; politeness keeps it welcome. Lose either one and coverage collapses.

12.8.2 Good to Have Traits Freshness Distribution and Extensibility

Beyond the two must traits, successful crawlers add more. Distribution across machines brings scalability and efficiency: many workers fetch in parallel instead of one worker fetching alone.

Freshness (continuous re crawling so fresh content is picked on time and page coverage stays full) means the crawl never truly ends. Pages change, so the crawler must revisit on a rhythm that tracks change: news homepages daily or hourly, stable reference pages rarely. Extensibility (support for many data formats such as HTML, JSON, and XML, with no limit to one format) means new page types and fetch protocols plug in without rebuilding the system.

Freshness and extensibility were marked as the two most important should have traits to address in a course crawler design. Assignment work with Request, BeautifulSoup, URL libraries, and Scrapy shows the same needs, since student crawlers must parse varied formats and revisit pages without overloading sites.

Picture freshness as a set of revisit timers, one per page, where fast-changing pages get short timers and stable pages get long ones. The horizontal axis is time since last fetch and the vertical axis is chance the copy is stale; refetching resets each page to zero. The takeaway is that crawl budget should follow change rate, not page count alone.

One-line recap: must-have traits keep crawling possible, while freshness, distribution, and extensibility keep it useful at scale. The next step is seeing where politeness rules live.

12.8.3 Robots Exclusion and URL Frontier Scope

Every large site exposes a robots file at domain slash robots dot txt. A live demo opened such a file. It lists disallow paths that shall not be crawled, allow paths that may be crawled, and a sitemap pointer. A blank rule grants full access, while specific rules grant only listed parts. The crawler must read and respect allow and disallow lines and build only from allowed crawls. A large shopping site was used to show allow, disallow, and sitemap lines in action.

Think of the robots file as the house rules pinned to the front door: guests may enter the living room, must skip the bedroom, and can find the full room list on the notice board (the sitemap). Ignoring the sign is trespass, and the host will lock the door.

The unseen web is the universe of URLs. Inside it sits the frontier, the list of URLs found but not yet crawled. Inside the frontier sits the smaller set already crawled and parsed. Frontier entries come from seed expansion and from newly found links, not from private crawler knowledge. In set terms: crawled pages form a small core, the frontier rings that core with known-but-unvisited URLs, and the unseen web stretches beyond both.

Scope: Robots rules bind the crawler per host and per path; they do not grant or deny the whole web at once. A rule learned on one domain never carries over to another. Assumption: Site owners keep the robots file current; a stale file can needlessly block fresh paths or wrongly open private ones.

12.8.4 Seeds Frontier Queue and Crawler Threads

The process starts with a small set of known seed pages, for example a university homepage or an encyclopedia page. Seeds enter the URL frontier first. The frontier acts like a queue with first in first out order, but not first in first out alone. It also prioritizes by page importance, freshness, domain priority, politeness limits, and crawl policy.

A crawling thread, also called the spider worker, takes one URL from the frontier, sends a request to the web server, downloads the page, parses content, and helps create index data. While parsing it finds more URLs and sends those new URLs back to the frontier. One crawler can do this loop, but many threads can work in parallel for much better throughput. That is why the diagram shows multiple threads.

Think of the frontier as an airport departure board with priority lanes: first in first out sets the base order, but freshness, politeness, domain, and policy lanes reorder who boards next, and many gates (threads) board passengers at once. The analogy breaks where politeness bites: two passengers for the same host cannot board together even if both are ready, because back-to-back hits on one server violate implicit politeness.

Q: With first in first out order how can multiple crawler threads work together?

A: The frontier starts with only seed URLs, then fills as parsing finds more links. First in first out sets base order, but priority rules for freshness, politeness, domain, and policy reorder picks. Multiple workers then pull from that shared frontier in parallel for faster operation.

Q: Does a search for a course start from the query and pull matching links from the frontier queue into posting lists?

A: Largely yes, with one fix. The frontier holds found but not yet crawled URLs. The thread fetches, parses, builds word to posting list index data, extracts fresh links from the parsed pages, checks seen state, indexes unseen content, and returns new URLs to the frontier for near future crawls. A university seed expands into admission, fee, and course links in this loop, and the unseen set shrinks as crawling proceeds.

12.8.5 Process Steps and System Modules

The crawl loop in order is pick a URL, fetch the document, parse text and links, check seen state and robots rules, index unseen content, and return new allowed URLs to the frontier. Duplicate and near duplicate elimination runs before new URLs re enter the frontier, and robots filtering keeps only allowed URLs. That ordering matters: filtering before fetching saves bandwidth, and dedup before re-queueing saves queue space.

Modules map to those steps. The URL frontier manages URLs to fetch. DNS resolution translates human readable links such as encyclopedia or university names into machine readable IP addresses such as 93 dot form, because the fetch stage can only use IP form. The fetching module downloads the page. The parsing module extracts text and links. The duplicate elimination module builds document fingerprints and drops repeats. URL filters apply robots rules. From there text with HTML, XML, or JSON tags passes to the indexer, which builds inverted indexes for query and ranked retrieval use. Python libraries named for implementation were Request, BeautifulSoup, URL handling libraries, and Scrapy, with more met during build work.

Think of the pipeline as an assembly line with quality gates: each station does one job and rejects bad items before they reach the next station. Robots rejects banned URLs early, dedup rejects repeats mid-line, and only clean text reaches the indexer at the end.

Memorize the loop as pick, fetch, parse, check, index, return. Each verb maps to one module, in the same order.

12.8.6 Frontier Load Issues and Student Questions and Answers

Two frontier issues need care. The frontier may hold many pages from the same host. A course seeker may have no interest in first degree course links that share the same host, yet those URLs still sit in the frontier because the host served them. There is no easy way to avoid them at discovery time. Thread load also needs care. Every thread should stay busy, but starting 200 workers for a 5 worker job wastes resources. Keep worker count matched to load.

Q: Can the frontier hold links beyond the seed topic, such as other institutes besides the seed university?

A: It holds whatever parsing encountered. Starting from one seed, only links found while parsing that seed return to the frontier. The crawler adds back found URLs and sends page text to the indexer. It does not invent outside links on its own.

Q: How does the seed plus first in first out plus priority reading fit together?

A: The seed enters first so it leaves first. After that, priority signals adjust order. First in first out is the base queue thought, with freshness, politeness, and domain rules layered on top.

Exam Guidance Summary

Exam note: No mark distribution, question pattern list, or date logistics for the final test were fixed in this session, so this section records study pointers actually stated. Duplicate removal, Jaccard on shingle sketches, capture recapture overlap math, query versus non query sampling trade offs, pointwise versus pairwise ranking on the laptop example, and crawler traits with frontier plus robots rules are the high value revision set.

Revise each item as a question you can answer from these notes. For duplicate handling, state why one copy must go and how Jaccard plus sketches find near copies. For size estimation, write the overlap equation from memory and redo the 60 percent against 40 percent numbers that give 1000 to 1500 pages. For sampling, contrast invented rare-term queries such as vocalist and RSI against log queries, and address throws against graph walks, naming one bias for each.

Exam note: Threshold choice for near duplicates, such as 70 percent versus 50 percent on the three document exercise, is a likely conceptual plus numerical prompt. Practice the verdict both ways: at a 70 percent cut the 50 percent pair is not a near duplicate, while at a lower cut it groups as duplicate. Always quote the threshold with the verdict.

Assignment two is out and is lengthy, built as a Streamlit app joining web search, web crawl, recommendation, and pre-processing into one product, done in teams, with an early start advised because evening sessions on crawler and recommendation directly help the build. Treat the crawler traits (robustness, politeness, freshness, extensibility) and the frontier plus robots rules as build checklist items, not just exam lines. A compensation class was announced for the evening in place of a missed August date, with a request to attend live and to use the follow up material when absent.

Key Industry Applications

Flight and railway booking show dynamic request built pages that challenge crawlers: inventory behind forms cannot be fetched without generating inputs. Japanese, Chinese, English, and French queries show why multilingual matching and interface support matter for real traffic. Trending news on court matters and hunger strike stories show why near duplicate filtering protects result diversity on breaking topics.

Keyword stuffing for TF-IDF gains, hidden text in matching colors, easy money doorway pages to instant loan sites, and video thumbnail lander pages show live spam forms, with spam detectors and penalties still incomplete even at large engines. Fish in a lake counting motivates capture recapture for index size, and the web as ocean extends the same thought to engine comparison.

Vocalist and RSI as rare conjunctive queries and user log queries show query based sampling in practice. Virtual hosting on shared IPs and company sites with unlinked employee pages show why IP sampling misses despite its clean theory. Jaguar as car, animal, and operating system shows why relevance shifts by user and time, which is the business case for learning to rank.

BM25, TF-IDF, PageRank, title and anchor match, freshness, load speed, clicks, and popularity show production rank features, with support vector machines and RankNet style learners as model options. Shopping site robots files with allow, disallow, and sitemap lines show explicit politeness in action. University and encyclopedia seeds plus Request, BeautifulSoup, URL libraries, and Scrapy show practical crawler builds that students can run and extend.

IR Lecture 12 notes · Web Search Challenges, Size Estimation, Near Duplicates and Crawling

Information Retrieval· undergraduate· 2026-09-13

Sections Breakdown

1Web Search Stages and Content Challenges

Three-stage crawl-index-query pipeline plus static, multilingual, duplicate, and spam challenges.

2Estimating the Size of a Web Search Engine

Index size on cleaned static set as the fair measure; domain counts fail; IP sampling fraction scales to universe.

3Capture Recapture for Relative Index Size

Fish-in-lake overlap logic gives xS1=yS2; worked 60/40 example yields 1500 and grid example gives triple size.

4Query Based Sampling

Random rare-term queries vs log queries feed the same overlap math with different biases.

5Sampling Without Queries

Random IP address loop is the preferred query-free baseline; random walk on link graph is the elegant alternative.

6Near Duplicate Detection With Shingles and Sketches

Shingle sets with Jaccard, hashed sketches with permutation minima estimating Jaccard; cat, truth-table, and three-doc worked examples.

7Learning to Rank for Web Results

Rank after retrieval; pointwise weighted sum scores docs alone; pairwise differences order D1 D2 D3.

8Web Crawler Design and Architecture

Robustness plus politeness are musts; frontier queue with priority and threads; robots, DNS, fetch, parse, dedup modules.

Undergraduate students studying Information Retrieval

Exam Revision Notes

Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.

Web Search Stages and Content Challenges

Must-know: Name the crawl-index-query stages and four content challenges with one example each.

Top pitfall: Mixing up spam (deliberate signal gaming) with duplicates (copied content).

Self-check: Why does a doorway page differ from a mirror page?

Connects to: 12.6, 12.8

Estimating the Size of a Web Search Engine

Must-know: Size means estimated index size on cleaned static set; f=V/S scales by N_total.

Top pitfall: Counting crawler fetches or domain registers instead of parsed index entries.

Self-check: With S=1000 and V=80, what is f?

Connects to: 12.3

Capture Recapture for Relative Index Size

Must-know: Overlap shares equate: xS1=yS2, so S1/S2=y/x.

Top pitfall: Forgetting the five steps: sample, subset, cross-check, equate, solve.

Self-check: If x=0.6, y=0.4, S1=1000, what is S2?

Connects to: 12.2, 12.4

Query Based Sampling

Must-know: Invented vocalist-RSI queries give control; log queries give realism; both carry bias.

Top pitfall: Using a zero-result query that breaks overlap shares.

Self-check: Name one bias unique to log-based sampling.

Connects to: 12.3, 12.5

Sampling Without Queries

Must-know: IP loop: random address, one page per host, ~100 repeats, then overlap ratio.

Top pitfall: Treating walk visit shares as uniform shares.

Self-check: Why is random IP sampling independent of rankers?

Connects to: 12.3, 12.4

Near Duplicate Detection With Shingles and Sketches

Must-know: Jaccard is intersection over union; sketch agreement share over ~200 rounds estimates it; state threshold with verdict.

Top pitfall: Calling 50 percent a duplicate without naming the threshold.

Self-check: At a 70 percent cut, is a 50 percent pair a near duplicate?

Connects to: 12.1, 12.8

Learning to Rank for Web Results

Must-know: Pointwise grades alone; pairwise sorts by wins; only 3 combos for 3 docs.

Top pitfall: Building six directed pairs instead of three combinations.

Self-check: D1 beats both, D2 beats D3 only: what is the order?

Connects to: 12.1

Web Crawler Design and Architecture

Must-know: Loop is pick, fetch, parse, check, index, return; impolite crawlers get blocked, banned, trapped.

Top pitfall: Reading FIFO as the only frontier order, ignoring priority and politeness.

Self-check: What do allow and disallow lines in robots.txt control?

Connects to: 12.1

Was this lecture useful?

Loading comments…
🤖

BitsNotes AI Assistant

Subject Notes Assistant

Configure AI Chat

Choose how to access the chatbot
Have your own API key?

Switch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.

🔑 Enter API key above to fetch live models from provider, or enter model name manually.
OpenAI-Compatible API Support

Choose any provider preset (Gemini, DeepSeek, Kimi, GLM, MiniMax, Qwen, OpenAI, Groq, Ollama, etc.) or enter a custom endpoint URL.

Security & Privacy First

Your API key is sent directly from your browser to your specified provider. BitsNotes servers never store or see your key.