web algorithmics web search engines. retrieve docs that are “relevant” for the user query doc :...

27
Web Algorithmics Web Search Engines

Post on 20-Dec-2015

218 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Web Algorithmics

Web Search Engines

Page 2: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Retrieve docs that are “relevant” for the user query

Doc: file word or pdf, web page, email, blog, e-book,...

Query: paradigm “bag of words”

Relevant ?!?

Goal of a Search Engine

Page 3: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Two main difficulties

The Web: Language and encodings: hundreds…

Distributed authorship: SPAM, format-less,…

Dynamic: in one year 35% survive, 20% untouched

The User: Query composition: short (2.5 terms avg) and imprecise

Query results: 85% users look at just one result-page

Several needs: Informational, Navigational, Transactional

Extracting “significant data” is difficult !!

Matching “user needs” is difficult !!

Page 4: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Evolution of Search Engines First generation -- use only on-page, web-text data

Word frequency and language

Second generation -- use off-page, web-graph data Link (or connectivity) analysis Anchor-text (How people refer to a page)

Third generation -- answer “the need behind the query” Focus on “user need”, rather than on query Integrate multiple data-sources Click-through data

1995-1997 AltaVista, Excite, Lycos, etc

1998: Google

Fourth generation Information Supply[Andrei Broder, VP emerging search tech, Yahoo! Research]

Google, Yahoo,

MSN, ASK,………

Page 5: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query
Page 6: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query
Page 7: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query
Page 8: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query
Page 9: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

This is a search engine!!!

Page 10: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Web Algorithmics

The structure of a Search Engine

Page 11: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

The structureW

eb

Crawler

Page archive

Control

Query

Queryresolver

?

Ranker

PageAnalizer

textStructure

auxiliary

Indexer

Page 12: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query
Page 13: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Problem: Indexing

Consider Wikipedia En: Collection size ≈ 10 Gbytes # docs ≈ 4 * 106 #terms in total > 1 billion (avg term len = 6 chars) #terms distinct = several millions

Which kind of data structure do we build to support word-based searches ?

Page 14: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

DB-based solution: Term-Doc matrix

1 if play contains word, 0 otherwise

Antony and Cleopatra Julius Caesar The Tempest Hamlet Othello Macbeth

Antony 1 1 0 0 0 1

Brutus 1 1 0 1 0 0

Caesar 1 1 0 1 1 1

Calpurnia 0 1 0 0 0 0

Cleopatra 1 0 0 0 0 0

mercy 1 0 1 1 1 1

worser 1 0 1 1 1 0

#te

rms >

1M

#docs ≈ 4M

Space ≈ 4Tb !

Page 15: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Current solution: Inverted index

Brutus

the

Calpurnia

1 2 3 5 8 13 21 34

2 4 6 10 32

13 16

Currently they get 24% original text

A term like Calpurnia may use log2 N bits per occurrence A term like the should take about 1 bit per occurrence

Page 16: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Gap-coding for postings

Sort the docIDs Store gaps between consecutive docIDs:

Brutus: 33, 47, 154, 159, 202 … 33, 14, 107, 5, 43 …

Two advantages: Space: store smaller integers (clustering?) Speed: query requires just a scan

Page 17: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

code for integer encoding

x > 0 and Length = log2 x +1

e.g., 9 represented as <000,1001>.

code for x takes 2 log2 x +1 bits (ie. factor of 2 from optimal)

0000...........0 x in binary Length-1

Optimal for Pr(x) = 1/2x2, and i.i.d integers

Page 18: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Rice code (simplification of Golomb code)

It is a parametric code: depends on k

Quotient q=(v-1)/k, and the rest is r= v – k * q – 1

Useful when integers concentrated around k

How do we choose k ? Usually k 0.69 * mean(v) [Bernoulli model]

Optimal for Pr(x) = p (1-p)x-1, where mean(x)=1/p, and i.i.d ints

Unary(q+1) Binary rest

[q times 0s] 1 Log k bits

Page 19: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

PForDelta coding

10 11 11 …01 01 11 11 01 42 2311 10

2 3 3 …1 1 3 3 23 13 42 2

a block of 128 numbers

Use b (e.g. 2) bits to encode 128 numbers or create exceptions

Several approaches to encode exceptions

Choose b to encode 90% values, or trade-off: b waste more bits, b more exceptions

Translate data

Page 20: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Interpolative coding

= 1 1 1 2 2 2 2 4 3 1 1 1M = 1 2 3 5 7 9 11 15 18 19 20 21

Recursive coding preorder traversal of a balanced binary tree

At every step we know:lowest possible value, highest possible value, number of values, i.e. num = |M| = 12, low = 1, hi = 21

Take the middle element: h=6 M[6]=9

It is 1+5 = 6 ≤ M[h] ≤ 21 – (12 – 6) = 15 We can encode 9 in log2 (15-6) = 4 bits

lo=1, hi=8, num =

5

lo=10, hi=21, num =

6

Page 21: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Query processing

1) Retrieve all pages matching the query

Brutus

the

Caesar

1 2 3 5 8 13 21 34

2 4 6 13 32

4 13 17

Page 22: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Some optimization

Best order for query processing ? Shorter lists first…

Brutus

Caesar

Calpurnia

1 2 3 5 8 13 21 34

2 4 8 13 31

13 16

Query: Brutus AND Calpurnia AND Caesar

Page 23: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Expand the posting lists with word positions to:

2:1,17,74,222,551; 4:8,16,190,429,433; 7:13,23,191; ...

be:

1:17,19; 4:17,191,291,430,434; 5:14,19,101; ...

Larger space occupancy, about *10 on Web

Phrase queries

Page 24: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Query processing

1) Retrieve all pages matching the query 2) Order pages according to various scores:

Term position & freq (body, title, anchor,…)

Link popularity User clicks or preferences

Brutus

the

Caesar

1 2 3 5 8 13 21 34

2 4 6 13 32

4 13 17

Page 25: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Generating the snippets !

Page 26: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

The big fight: find the best ranking...

Page 27: Web Algorithmics Web Search Engines. Retrieve docs that are “relevant” for the user query Doc : file word or pdf, web page, email, blog, e-book,... Query

Ranking: Google vs Google.cn