porting information retrieval code from rivet