BREAKING: Lucene.Net.QueryParsers.Flexible: Removed NLS Support #484
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This removes support for NLS. This feature allowed lazy-loading of localized resource messages, but required the exceptions to accept an
IMessage
instance instead of a string. This makes it very inconvenient to use the following exception types in theLucene.Net.QueryParsers.Flexible
namespace:Core.QueryNodeError
Core.QueryNodeException
Core.QueryNodeParseException
Standard.Parser.ParseException
These exceptions were refactored to accept a string message and to accept an
innerException
so they can be properly re-thrown. It also allows users to supply their own exception messages inline more easily with the option to use resource files, if desired.This also removes
Lucene.Net.Util.BundleResourceManagerFactory
andIResourceManagerFactory
which were to allow users to supply their ownResourceManger
instance based on the type passed.BundleResourceManagerFactory
andNLS
were awkward to use because they required a "Bundle" suffix on the resource that was added to the project and to add a subclass ofNLS
with static fields even though Visual Studio already generates one.The following classes were removed from the
Lucene.Net.QueryParsers.Flexible
namespace:Messages.Message
Messages.IMessage
Messages.NLS
Messages.INLSException
The Java-like design was abandoned and
QueryParserMessages
was redesigned to be similar to the auto-generated class for QueryParser, however it now uses a class namedQueryParserResourceProvider
(which implementsIResourceProvider
) that contains the fallback logic for supplying customResourceProvider
instances without any special constraints on the naming or other conventions used for creating the resources. End users can supply their own resources by setting theIResourceProvider
at application startup. The built-in implementation,QueryParserResourceProvider
accepts zero to manyResourceManager
instances in its constructor, so supplying localized messages is now as easy as:at application startup.
The old NLS tests were commented out, and tests were added for the new features to confirm the fallback logic is working correctly.