Let D be a collection of D documents, which are strings over an alphabet of size σ, of total length n. We describe a data structure that uses linear space and and reports k most relevant documents that contain a query pattern P , which is a string of length p packed in p/ logσ n words, in time O(p/ logσ n+k). This is optimal in the RAM model in the general case where logD = Θ(log n), and involv...