Basic

What a search engine is for

A search engine answers a question with a list. The list is short, and the shortness is the whole design decision of the subject.

What you will see

top_k 10. The shortness is a number, which is the decision.

About 1 min of reading

Try It

Write the two costs

1

Write the library size

printf 'docs 4000\n' > /tmp/n.txt; cat /tmp/n.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
docs 4000. The size is what an answer that reads would pay.
2

Write the build cost

printf 'build_once 4000\nanswer_reads 0\n' > /tmp/c.txt; cat /tmp/c.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Two lines. Zero documents read per answer is the claim.
3

Write the list length

printf 'top_k 10\n' > /tmp/k.txt; cat /tmp/k.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
top_k 10. The shortness is a number, which is the decision.

Data Flow

A question to a short list
1 The documents are read once at build
↓
2 A structure is written from the reading
↓
3 The question is answered from the structure
↓
4 The list is short because the order was decided
Why this works
Why the reading is moved out of the answer

An answer that reads every document is an answer whose cost grows with the library. The move is the whole fix.

The claim of this subject

A structure built once and read many times. That structure is what every later lesson shapes.

Examples

The input is a question

The question is words, not a name. Words mean the reader does not know the place, which is the reason the answer is a list.

The answer is a ranked list

Ranked means an order exists. An order is a claim, and a claim is what a test can check.

The cost is read once

Reading the documents is paid at build time. Paying at build time is what makes an answer fast.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

Next Lesson
Reading documents honestly
Reading documents honestly →