Hi I am trying to use DotNetRDf.Query.FullText in .Net core 3.1 to create Lucene indexer but getting below run time exception. Can you please help to resolve this issue?
System.TypeLoadException HResult=0x80131522 Message=Could not load type 'MaxFieldLength' from assembly 'Lucene.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=85089178b9ac3181'.
Sample Code:
var indexer = new LuceneObjectsIndexer(new RAMDirectory(), new StandardAnalyzer(LuceneVersion), new DefaultIndexSchema());
Package Version Used: DotNetRDF - 2.1.6 Lucene - 4.8.0-beta00013
Something seems odd about this. Lucene.net 3.x had a MaxFieldLength
type that could be passed in an IndexWriter
constructor but Lucene.net 4.X has no such type and it's IndexWriter
class has no constructor that accepts such a parameter.
See Lucene.net 3.03 ImageWriter class and compare that to Lucene.net 4.8 ImageWriter class
So it feels like the the DotNetRdf library may have been written to depend on a ImageWriter
constructor that is only available in a 3.X version of Lucene. If you show a full stack trace that may help shed more light on the situation.
Looking at the dotnetrdf.org site I didn't see where they document what version of Lucene they use, but this error makes it pretty clear the library is designed for Lucene.Net 3.x. I'd recommend trying to use the Lucene.Net 3.03
Nuget packages rather than the 4.8 beta packages and see if that resolves your issues.