Specify the term-document matrix.

A=(({{1, 0, 0}, {3, 3, 0}, {1, 0, 1}}))

Create a query vector.

q = {1, 0, 0}

Find the inner product of the query with every original document (column of A) by matrix/vector multiplication.

Transpose[A] . q

Calculate the Singular Value Decomposition of A into three matrices.

{U, S, V} = SingularValues[N[A]]

Check that the SVD, when multiplied, gives back the original matrix.

Transpose[U] . DiagonalMatrix[S] . V

Create a truncated S diagonal matrix, with all elements being 0 except the first.

Sp  =  Table[If[i == 1, S[[i]],  0],  {i,  1, 3}]

Multiply the new S with U and V, to create an approximation of the term-document space.

Ap  =  Transpose[U] . DiagonalMatrix[Sp] . V

Find the inner product of the query with every document of Ap, the approximated term-document space.

Transpose[Ap] . q