10 Aug 2004
CS 5244: Orientation
46/32
Sort-based inversion
¡Idea: try to make random access of disk (memory) sequential
¡
¡// Phase I – collection of term appearances on disk
¡For each document Dd in collection, 1 ≤ d ≤ N
¡ Read Dd, parsing it into index terms
¡ For each index term t in Dd
¡ Calculate fd,t
¡ Dump to file a tuple (t,d,fd,t)
 
¡// Phase II – sort tuples
¡Sort all the tuples (t,d,f) using External Mergesort
¡
¡// Phase III – write output file
¡Read the tuples in sorted order and create inverted file