Information Retrieval
Information Retrieval
Information Retrieval
Assignment 1 - Solutions
Which document(s) (if any) match each of the following queries at which positions, where each ex-
pression within quotes is a phrase query? (i) “fools rush in” (ii) “fools rush in” AND “angels fear to
tread”.
Solution
(i) doc2:1, doc4:8, doc7:3,13 (ii) doc4:8 & 12
Solution
See boolean.py in the assignment 1 ex 2 solution.zip file on the course homepage.
Solution
Solution
Processing postings list in order of size (i.e. the shortest postings list first) is usually a good approach.
But it is not optimal e. g. in a conjunctive query with three terms:
term 1 −→ 1 2 3
term 2 −→ 2 3 4 5
term 3 −→ 10 11 20 30 50
As we can see there is no document containing all three query terms. If we would have checked the
first posting of the third list right at the beginning, we would have noticed that there is no intersection
between the first and the third postings list. That would make any further search superfluous.