The cosine similarity between two vectors is the dot product of the unit vectors in their respective directions, i.e., the cosine of the angle between the two vectors:
Cosine similarity can be seen as a normalized inner product similarity such that it always has unit length. As such, it does not upweight large-magnitude vectors, such as longer documents in full-text search.