This is part of my code.
idf=self.getInverseDocFre(word) ##this idf is from the collection
qi=count*idf
di=self.docTermCount[docid][word]*idf
similiarity+=qi*di
similiarity/=self.docSize[docid]
this is wikipedia https://en.wikipedia.org/wiki/Vector_space_model#Example:_tf-idf_weights
this is an example from web http://www.site.uottawa.ca/~diana/csi4107/cosine_tf_idf_example.pdf
My question is that, if idf for the query is the same idf from the collection?
Is that why I have to multiply the idf for the similiarity twice?
I am afraid that I am wrong about the concept of idf for the query part.