code: func (conf *IndexWriterConfig) SetSimilarity(similarity Similarity) *IndexWriterConfig {
  	assert2(similarity != nil, "similarity must not be nil")
  	conf.similarity = similarity
  	return conf
  }
docs: // L259
  /*
  Expert: set the Similarity implementation used by this IndexWriter.
  
  NOTE: the similarity cannot be nil.
  
  Only takes effect when IndexWriter is first created.
  */