Im reading a paper by Matomaki here, and the following is stated (I'm paraphrasing):

"By the Cauchy-Schwarz inequality and the large sieve, we have $$\sum_{q \leq Q}\frac{q}{\phi(q)}\sum_{\substack{\chi\text{(mod $q$)}\\\text{primtiive}}} \big{|}\sum_{a \in \mathcal{A}}\chi(a)\sum_{b \in \mathcal{B}}\chi(b) \big{|} \leq (Q^2 + N)(AB)^{1/2}$$ where $Q,N$ are positive integers and $\mathcal{A}, \mathcal{B}\subseteq \{1,...,N\}$ and $|\mathcal{A}| = A$ and $|\mathcal{B}| = B$."

Now I am not so concerned with the application of the large sieve, but I am a little confused about how she applied Cauchy-Schwarz. Of course the large sieve she is referring to states $$\sum_{q \leq Q}\frac{q}{\phi(q)}\sum_{\substack{\chi\text{(mod $q$)}\\\text{primtiive}}} \big{|}\sum_{n \leq N }a_n\chi(n)\big{|}^2 \leq (Q^2 + N)\sum_{n \leq N}|a_n|^2.$$

But I am unsure of how she used Cauchy-Schwarz, especially with multiplicative characters. Does anyone have any thoughts?