The prior probability P (D) is usually assumed to be uniform and a language model P (Q|D) is estimated for every document.
they estimate a probability distribution over words for each document and calculate the probability that the query is a sample from that distribution.