Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class QueryParserResourceProvider

    The default Lucene.Net.Util.IResourceProvider implementation for the QueryParserMessages class. This class can be set in the SetResourceProvider(IResourceProvider) method and supplied with one or more ResourceManager instances that can override the default query parser messages (generally, they are exception messages).

    Alternatively, this class may be overridden to provide either a custom FallbackResourceManager or to alter the fallback logic in either GetString(string, CultureInfo?) or GetObject(string, CultureInfo?). The performance of this class may be improved significantly by specifying the ResourceManager that a specific resource can be found in rather than attempting all of them.
    Inheritance
    object
    QueryParserResourceProvider
    Implements
    IResourceProvider
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.QueryParsers.Flexible.Core.Messages
    Assembly: Lucene.Net.QueryParser.dll
    Syntax
    public class QueryParserResourceProvider : IResourceProvider

    Constructors

    QueryParserResourceProvider()

    Initializes a new instance of the QueryParserResourceProvider class with default values.

    Declaration
    public QueryParserResourceProvider()

    QueryParserResourceProvider(IList<ResourceManager>)

    Initializes a new instance of the QueryParserResourceProvider class with the specified resourceManagers. The resourceManagers may override resources in the FallbackResourceManager, provided they have the same names.

    Note that not all of the resources are required to be provided and if the name doesn't exist it will fall back to the next ResourceManager that is provided and ultimately will try the FallbackResourceManager if the resource is not found.
    Declaration
    public QueryParserResourceProvider(IList<ResourceManager> resourceManagers)
    Parameters
    Type Name Description
    IList<ResourceManager> resourceManagers

    One or more ResourceManager instances that provide localized resources. The resourceManagers are used in the order they are specified, and the first one that provides a non-null value for a given resource name wins.

    Exceptions
    Type Condition
    ArgumentNullException

    If resourceManagers is null.

    QueryParserResourceProvider(params ResourceManager[])

    Initializes a new instance of the QueryParserResourceProvider class with the specified resourceManagers. The resourceManagers may override resources in the FallbackResourceManager, provided they have the same names.

    Note that not all of the resources are required to be provided and if the name doesn't exist it will fall back to the next ResourceManager that is provided and ultimately will try the FallbackResourceManager if the resource is not found.
    Declaration
    public QueryParserResourceProvider(params ResourceManager[] resourceManagers)
    Parameters
    Type Name Description
    ResourceManager[] resourceManagers

    One or more ResourceManager instances that provide localized resources. The resourceManagers are used in the order they are specified, and the first one that provides a non-null value for a given resource name wins.

    Exceptions
    Type Condition
    ArgumentNullException

    If resourceManagers is null.

    Properties

    FallbackResourceManager

    Gets the cached ResourceManager instance used as the fallback by this class.

    Declaration
    public virtual ResourceManager FallbackResourceManager { get; }
    Property Value
    Type Description
    ResourceManager

    Methods

    GetObject(string, CultureInfo?)

    Gets the value of the specified non-string resource localized for the specified culture.

    The resource is searched for first in the ResourceManager instances passed in the QueryParserResourceProvider(IList<ResourceManager>) or QueryParserResourceProvider(params ResourceManager[]) constructor, in the order they are specified. If not found, the FallbackResourceManager is used. This method may return null if the resource with the given name is not found.
    Declaration
    public virtual object? GetObject(string name, CultureInfo? culture)
    Parameters
    Type Name Description
    string name

    The name of the resource to get.

    CultureInfo culture

    The culture for which the resource is localized. If the resource is not localized for this culture, the resource manager uses fallback rules to locate an appropriate resource.

    If this value is null, the CultureInfo object is obtained by using the CurrentUICulture property.
    Returns
    Type Description
    object

    The value of the resource, localized for the specified culture. If an appropriate resource set exists but name cannot be found, the method returns null.

    Exceptions
    Type Condition
    ArgumentNullException

    The name parameter is null.

    MissingManifestResourceException

    No usable set of resources has been found, and there are no resources for a default culture. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

    MissingSatelliteAssemblyException

    The default culture's resources reside in a satellite assembly that could not be found. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

    GetStream(string, CultureInfo?)

    Returns an unmanaged memory stream object from the specified resource, using the specified culture.

    The resource is searched for first in the ResourceManager instances passed in the QueryParserResourceProvider(IList<ResourceManager>) or QueryParserResourceProvider(params ResourceManager[]) constructor, in the order they are specified. If not found, the FallbackResourceManager is used. This method may return null if the resource with the given name is not found.
    Declaration
    public Stream? GetStream(string name, CultureInfo? culture)
    Parameters
    Type Name Description
    string name

    The name of a resource.

    CultureInfo culture

    An object that specifies the culture to use for the resource lookup. If culture is null, the culture for the current thread is used.

    Returns
    Type Description
    Stream

    An unmanaged memory stream object that represents a resource.

    Exceptions
    Type Condition
    ArgumentNullException

    The name parameter is null.

    InvalidOperationException

    The value of the specified resource is not a MemoryStream object.

    MissingManifestResourceException

    No usable set of resources has been found, and there are no resources for a default culture. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

    MissingSatelliteAssemblyException

    The default culture's resources reside in a satellite assembly that could not be found. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

    GetString(string, CultureInfo?)

    Returns the value of the string resource localized for the specified culture.

    The resource is searched for first in the ResourceManager instances passed in the QueryParserResourceProvider(IList<ResourceManager>) or QueryParserResourceProvider(params ResourceManager[]) constructor, in the order they are specified. If not found, the FallbackResourceManager is used. This method may return null if the resource with the given name is not found.
    Declaration
    public virtual string? GetString(string name, CultureInfo? culture)
    Parameters
    Type Name Description
    string name

    The name of the resource to retrieve.

    CultureInfo culture

    An object that represents the culture for which the resource is localized.

    Returns
    Type Description
    string

    The value of the resource localized for the specified culture, or null if name cannot be found in a resource set.

    Exceptions
    Type Condition
    ArgumentNullException

    The name parameter is null.

    InvalidOperationException

    The value of the specified resource is not a string.

    MissingManifestResourceException

    No usable set of resources has been found, and there are no resources for a default culture. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

    MissingSatelliteAssemblyException

    The default culture's resources reside in a satellite assembly that could not be found. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

    Implements

    Lucene.Net.Util.IResourceProvider
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.