How to correctly infer vectors in Gensim doc2vec?
I would use the first approach, given that both train and test are known, there is no need of generalization i.e. you don't expect unseen vectors. 

In order to avoid the problem you mentioned, you have to find the most similar vector to a vector in test considering  only vectors in train. For example:

train = [v1, v2, v3]
test = [v4, v5]
most_similar = {}
for vector in test:
most_similar[vector] = v1
  for vector2 in train:
   if similarity(vector2, vector) &gt; similarity(most_similar[vector], vector):
     most_similar[vector] = vector2


In the end in most_similar you have the most similar vector in train for each vector in test.