Let $x$ and $y$ be two elements of $S_n$. Let $U(x,y)$ be the intersection $(BxB \cap B_{-} y B)/B$ inside the flag variety. Here $B$ and $B_{-}$ are the groups of upper and lower-triangular matrices respectively. Kazhdan and Lusztig define the $R$ polynomial $R_{x,y}(q)$. As explained in Theorem 1.3 of Deodhar, one such description is that $$R_{x,y}(q) = \# U(x,y)(\mathbb{F}_q).$$
Now, $U(x,y)$ is an affine variety, so I don't get to know that the weight filtration matches the cohomological filtration. But, looking at examples, it looks like the coefficient of $(-1)^{\ell(x) - \ell(y) - i } q^i$ in $R_{x,y}(q)$ is the Betti number $\dim H^i(U(x,y))$. For example, with $n=2$, $x=(21)$ and $y$ being the identity, then $U(x,y)$ is the torus $\mathbb{A}^1 \setminus \{ 0 \}$, it has $q-1$ points, and its betti numbers are $\dim H^0 = \dim H^1 = 1$.
This is probably something very standard, but I didn't find it the first few places I tried, and it seemed faster to ask here than to keep looking. Thanks!