Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Interface IIndexableField

    Represents a single field for indexing. IndexWriter consumes IEnumerable<IndexableField> as a document.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public interface IIndexableField

    Properties

    | Improve this Doc View Source

    Boost

    Returns the field's index-time boost.

    Only fields can have an index-time boost, if you want to simulate a "document boost", then you must pre-multiply it across all the relevant fields yourself.

    The boost is used to compute the norm factor for the field. By default, in the ComputeNorm(FieldInvertState) method, the boost value is multiplied by the length normalization factor and then rounded by EncodeNormValue(Single) before it is stored in the index. One should attempt to ensure that this product does not overflow the range of that encoding.

    It is illegal to return a boost other than 1.0f for a field that is not indexed (IsIndexed is false) or omits normalization values (OmitNorms returns true).

    Declaration
    float Boost { get; }
    Property Value
    Type Description
    System.Single
    See Also
    ComputeNorm(FieldInvertState)
    EncodeNormValue(Single)
    | Improve this Doc View Source

    IndexableFieldType

    IIndexableFieldType describing the properties of this field.

    Declaration
    IIndexableFieldType IndexableFieldType { get; }
    Property Value
    Type Description
    IIndexableFieldType
    | Improve this Doc View Source

    Name

    Field name

    Declaration
    string Name { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    NumericType

    Gets the NumericFieldType of the underlying value, or NONE if the value is not set or non-numeric.

    Expert: The difference between this property and NumericType is this is represents the current state of the field (whether being written or read) and the FieldType property represents instructions on how the field will be written, but does not re-populate when reading back from an index (it is write-only).

    In Java, the numeric type was determined by checking the type of
    GetNumericValue(). However, since there are no reference number types in .NET, using GetNumericValue() so will cause boxing/unboxing. It is therefore recommended to use this property to check the underlying type and the corresponding Get*Value() method to retrieve the value.

    NOTE: Since Lucene codecs do not support BYTE or INT16, fields created with these types will always be INT32 when read back from the index.

    Declaration
    NumericFieldType NumericType { get; }
    Property Value
    Type Description
    NumericFieldType

    Methods

    | Improve this Doc View Source

    GetBinaryValue()

    Non-null if this field has a binary value.

    Declaration
    BytesRef GetBinaryValue()
    Returns
    Type Description
    BytesRef
    | Improve this Doc View Source

    GetByteValue()

    Returns the field value as System.Byte or null if the type is non-numeric.

    Declaration
    byte? GetByteValue()
    Returns
    Type Description
    System.Nullable<System.Byte>

    The field value or null if the type is non-numeric.

    | Improve this Doc View Source

    GetDoubleValue()

    Returns the field value as System.Double or null if the type is non-numeric.

    Declaration
    double? GetDoubleValue()
    Returns
    Type Description
    System.Nullable<System.Double>

    The field value or null if the type is non-numeric.

    | Improve this Doc View Source

    GetInt16Value()

    Returns the field value as System.Int16 or null if the type is non-numeric.

    Declaration
    short? GetInt16Value()
    Returns
    Type Description
    System.Nullable<System.Int16>

    The field value or null if the type is non-numeric.

    | Improve this Doc View Source

    GetInt32Value()

    Returns the field value as System.Int32 or null if the type is non-numeric.

    Declaration
    int? GetInt32Value()
    Returns
    Type Description
    System.Nullable<System.Int32>

    The field value or null if the type is non-numeric.

    | Improve this Doc View Source

    GetInt64Value()

    Returns the field value as System.Int64 or null if the type is non-numeric.

    Declaration
    long? GetInt64Value()
    Returns
    Type Description
    System.Nullable<System.Int64>

    The field value or null if the type is non-numeric.

    | Improve this Doc View Source

    GetNumericValue()

    Non-null if this field has a numeric value.

    Declaration
    [Obsolete("In .NET, use of this method will cause boxing/unboxing. Instead, use the NumericType property to check the underlying type and call the appropriate GetXXXValue() method to retrieve the value.")]
    object GetNumericValue()
    Returns
    Type Description
    System.Object
    | Improve this Doc View Source

    GetReaderValue()

    Non-null if this field has a System.IO.TextReader value

    Declaration
    TextReader GetReaderValue()
    Returns
    Type Description
    System.IO.TextReader
    | Improve this Doc View Source

    GetSingleValue()

    Returns the field value as System.Single or null if the type is non-numeric.

    Declaration
    float? GetSingleValue()
    Returns
    Type Description
    System.Nullable<System.Single>

    The field value or null if the type is non-numeric.

    | Improve this Doc View Source

    GetStringValue()

    Non-null if this field has a string value.

    Declaration
    string GetStringValue()
    Returns
    Type Description
    System.String

    The string representation of the value if it is either a System.String or numeric type.

    | Improve this Doc View Source

    GetStringValue(IFormatProvider)

    The value of the field as a System.String, or null. If null, the System.IO.TextReader value or binary value is used. Exactly one of GetStringValue(), GetReaderValue(), and GetBinaryValue() must be set.

    Declaration
    string GetStringValue(IFormatProvider provider)
    Parameters
    Type Name Description
    System.IFormatProvider provider

    An object that supplies culture-specific formatting information. This parameter has no effect if this field is non-numeric.

    Returns
    Type Description
    System.String

    The string representation of the value if it is either a System.String or numeric type.

    | Improve this Doc View Source

    GetStringValue(String)

    The value of the field as a System.String, or null. If null, the System.IO.TextReader value or binary value is used. Exactly one of GetStringValue(), GetReaderValue(), and GetBinaryValue() must be set.

    Declaration
    string GetStringValue(string format)
    Parameters
    Type Name Description
    System.String format

    A standard or custom numeric format string. This parameter has no effect if this field is non-numeric.

    Returns
    Type Description
    System.String

    The string representation of the value if it is either a System.String or numeric type.

    | Improve this Doc View Source

    GetStringValue(String, IFormatProvider)

    The value of the field as a System.String, or null. If null, the System.IO.TextReader value or binary value is used. Exactly one of GetStringValue(), GetReaderValue(), and GetBinaryValue() must be set.

    Declaration
    string GetStringValue(string format, IFormatProvider provider)
    Parameters
    Type Name Description
    System.String format

    A standard or custom numeric format string. This parameter has no effect if this field is non-numeric.

    System.IFormatProvider provider

    An object that supplies culture-specific formatting information. This parameter has no effect if this field is non-numeric.

    Returns
    Type Description
    System.String

    The string representation of the value if it is either a System.String or numeric type.

    | Improve this Doc View Source

    GetTokenStream(Analyzer)

    Creates the TokenStream used for indexing this field. If appropriate, implementations should use the given Analyzer to create the TokenStreams.

    Declaration
    TokenStream GetTokenStream(Analyzer analyzer)
    Parameters
    Type Name Description
    Analyzer analyzer

    Analyzer that should be used to create the TokenStreams from

    Returns
    Type Description
    TokenStream

    TokenStream value for indexing the document. Should always return a non-null value if the field is to be indexed

    Exceptions
    Type Condition
    System.IO.IOException

    Can be thrown while creating the TokenStream

    Extension Methods

    IndexableFieldExtensions.GetByteValueOrDefault(IIndexableField)
    IndexableFieldExtensions.GetInt16ValueOrDefault(IIndexableField)
    IndexableFieldExtensions.GetInt32ValueOrDefault(IIndexableField)
    IndexableFieldExtensions.GetInt64ValueOrDefault(IIndexableField)
    IndexableFieldExtensions.GetSingleValueOrDefault(IIndexableField)
    IndexableFieldExtensions.GetDoubleValueOrDefault(IIndexableField)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2021 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.