I can't understand how the author used Bayes rule to conclude this equation:
\begin{equation*} \begin{aligned} P(R=1 | Q,D)& = P(D | R = 1, Q)P(R=1|Q)/P(D|Q) \end{aligned} \end{equation*}
this equation taken from book introduction to information retrieval page 227
This is straight forward. Everything is conditioned on $Q$. Forget $Q$ for a second and apply Bayes rule.
Bayes rule says that $$ p(R | D) = \frac{p(D|R) p(R)}{p(D)} $$
This still holds if you have one more random variable $Q$ that you condition on. In that case $$ p(R | D, Q) = \frac{p(D|R, Q) p(R| Q)}{p(D|Q)} $$