apache / lucenenet

Apache Lucene.NET
https://lucenenet.apache.org/
Apache License 2.0
2.24k stars 639 forks source link

Fixed encoding provider loading on .NET Framework (for .NET Standard 2.0 target) #1036

Closed NightOwl888 closed 6 days ago

NightOwl888 commented 6 days ago

Summary of the changes (Less than 80 chars)

Fixed encoding provider loading on .NET Framework (for .NET Standard 2.0 target)

Fixes #1025

Description

Added EncodingProviderInitializer class to Lucene.Net.Analysis.Kuromoji and Lucene.Net.Analysis.SmartCn to prevent loading problems on the netstandard2.0 target when the runtime is .NET Framework.

NightOwl888 commented 6 days ago

Looks good, unless we wanted to share EncodingProviderInitializer between the projects in Lucene.Net core.

Yeah, I thought of that, but it requires a dependency on System.Text.Encoding.CodePages. So, the best we can do to share this is to make it a linked file that does not a belong to any project.

There is quite a bit of duplicated code in these analysis projects (for example CSVUtil in kuromoji and nori), so this seems like the trend.