You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by Bryan Rojo <Br...@elliottelectric.com> on 2018/04/16 14:06:21 UTC

DefaultSimilarity can no longer be set statically (and dangerously) for the entire JVM.


Previously I had

.Net.Search.Similarity.Default = New LuceneIgnoreSimilarity

According to the migration Guide :

LUCENE-2236<https://issues.apache.org/jira/browse/LUCENE-2236>, LUCENE-2912<https://issues.apache.org/jira/browse/LUCENE-2912>: DefaultSimilarity can no longer be set statically (and dangerously) for the entire JVM. Similarity can now be configured on a per-field basis (via PerFieldSimilarityWrapper) Similarity has a lower-level API, if you want the higher-level vector-space API like in previous Lucene releases, then look at TFIDFSimilarity.

How can I configure this per field? Any examples you would like to share?

Found this online but this method doesn't exist

IndexWriterConfig config = new IndexWriterConfig(analyzer);
config.setSimilarity(perFieldSimilarities);