Show / Hide Table of Contents

    Class Extensions

    The Extensions class represents an extension mapping to associate ParserExtension instances with extension keys. An extension key is a string encoded into a Lucene standard query parser field symbol recognized by ExtendableQueryParser. The query parser passes each extension field token to SplitExtensionField(String, String) to separate the extension key from the field identifier.

    In addition to the key to extension mapping this class also defines the field name overloading scheme. ExtendableQueryParser uses the given extension to split the actual field name and extension key by calling SplitExtensionField(String, String). To change the order or the key / field name encoding scheme users can subclass Extensions to implement their own.

    Inheritance
    System.Object
    Extensions
    Namespace: Lucene.Net.QueryParsers.Ext
    Assembly: Lucene.Net.QueryParser.dll
    Syntax
    public class Extensions : object

    Constructors

    | Improve this Doc View Source

    Extensions()

    Creates a new Extensions instance with the DEFAULT_EXTENSION_FIELD_DELIMITER as a delimiter character.

    Declaration
    public Extensions()
    | Improve this Doc View Source

    Extensions(Char)

    Creates a new Extensions instance

    Declaration
    public Extensions(char extensionFieldDelimiter)
    Parameters
    Type Name Description
    System.Char extensionFieldDelimiter

    the extensions field delimiter character

    Fields

    | Improve this Doc View Source

    DEFAULT_EXTENSION_FIELD_DELIMITER

    The default extension field delimiter character. This constant is set to ':'

    Declaration
    public static readonly char DEFAULT_EXTENSION_FIELD_DELIMITER
    Field Value
    Type Description
    System.Char

    Properties

    | Improve this Doc View Source

    ExtensionFieldDelimiter

    Returns the extension field delimiter

    Declaration
    public virtual char ExtensionFieldDelimiter { get; }
    Property Value
    Type Description
    System.Char

    Methods

    | Improve this Doc View Source

    Add(String, ParserExtension)

    Adds a new ParserExtension instance associated with the given key.

    Declaration
    public virtual void Add(string key, ParserExtension extension)
    Parameters
    Type Name Description
    System.String key

    the parser extension key

    ParserExtension extension

    the parser extension

    | Improve this Doc View Source

    BuildExtensionField(String)

    Builds an extension field string from a given extension key and the default query field. The default field and the key are delimited with the extension field delimiter character. This method makes no assumption about the order of the extension key and the field. By default the extension key is appended to the end of the returned string while the field is added to the beginning. Special Query characters are escaped in the result.

    Note: Extensions subclasses must maintain the contract between BuildExtensionField(String) and BuildExtensionField(String, String) where the latter inverts the former.

    Declaration
    public virtual string BuildExtensionField(string extensionKey)
    Parameters
    Type Name Description
    System.String extensionKey

    the extension key

    Returns
    Type Description
    System.String

    escaped extension field identifier

    | Improve this Doc View Source

    BuildExtensionField(String, String)

    Builds an extension field string from a given extension key and the default query field. The default field and the key are delimited with the extension field delimiter character. This method makes no assumption about the order of the extension key and the field. By default the extension key is appended to the end of the returned string while the field is added to the beginning. Special Query characters are escaped in the result.

    Note: Extensions subclasses must maintain the contract between BuildExtensionField(String) and BuildExtensionField(String, String) where the latter inverts the former.

    Declaration
    public virtual string BuildExtensionField(string extensionKey, string field)
    Parameters
    Type Name Description
    System.String extensionKey

    the extension key

    System.String field

    the field to apply the extension on.

    Returns
    Type Description
    System.String

    escaped extension field identifier

    Remarks

    See BuildExtensionField(String) to use the default query field

    | Improve this Doc View Source

    EscapeExtensionField(String)

    Escapes an extension field. The default implementation is equivalent to Escape(String).

    Declaration
    public virtual string EscapeExtensionField(string extfield)
    Parameters
    Type Name Description
    System.String extfield

    the extension field identifier

    Returns
    Type Description
    System.String

    the extension field identifier with all special chars escaped with a backslash character.

    | Improve this Doc View Source

    GetExtension(String)

    Returns the ParserExtension instance for the given key or

    null
    if no extension can be found for the key.
    Declaration
    public ParserExtension GetExtension(string key)
    Parameters
    Type Name Description
    System.String key

    the extension key

    Returns
    Type Description
    ParserExtension

    the ParserExtension instance for the given key or

    null
    if no extension can be found for the key.
    | Improve this Doc View Source

    SplitExtensionField(String, String)

    Splits a extension field and returns the field / extension part as a Tuple{string,string}. This method tries to split on the first occurrence of the extension field delimiter, if the delimiter is not present in the string the result will contain a

    null
    value for the extension key and the given field string as the field value. If the given extension field string contains no field identifier the result pair will carry the given default field as the field value.

    Declaration
    public virtual Tuple<string, string> SplitExtensionField(string defaultField, string field)
    Parameters
    Type Name Description
    System.String defaultField

    the default query field

    System.String field

    the extension field string

    Returns
    Type Description
    Tuple<System.String, System.String>

    a { with the field name as the and the extension key as the

    See Also

    ExtendableQueryParser
    ParserExtension
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)