lucenelucene.netmorelikethis

How to implement MoreLikeThis feature in Lucene.NET?


I am trying to use the MoreLikeThis feature but getting following error:

The type or namespace 'Similar' does not exist in the namespace 'Lucene.Net.Search' (are you missing an assembly reference?)

at the line:

var moreLikeThis = new Lucene.Net.Search.Similar.MoreLikeThis(indexReader);

I found this example here but don't know why Similar is missing. I have tried using various lucene.net version - 2.9.4, 3.0.3. What am I doing wrong? Or is there another way to use the MoreLikeThis feature?

Also, Is the MoreLikeThis feature available in lucene.net version 2.9.2.2?


Solution

  • I am able to get rid of the error for lucene.net version 2.9.4 and 3.0.3 by installing contrib library package from

    https://www.nuget.org/packages/Lucene.Net.Contrib/2.9.4.1 https://www.nuget.org/packages/Lucene.Net.Contrib/3.0.3

    Didn't found the contrib package for lucene.net version 2.9.2.2. hence build own library from lucene src found in following svn repository

    https://svn.apache.org/repos/asf/lucene/lucene.net/tags/Lucene.Net_2_9_2/contrib/Similarity.Net/Similarity.Net

    and used that library to implement MoreLikeThis feature.