Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class DefaultPassageFormatter

    Creates a formatted snippet from the top passages.

    The default implementation marks the query terms as bold, and places ellipses between unconnected passages.
    Inheritance
    object
    PassageFormatter
    DefaultPassageFormatter
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Search.PostingsHighlight
    Assembly: Lucene.Net.ICU.dll
    Syntax
    public class DefaultPassageFormatter : PassageFormatter

    Constructors

    DefaultPassageFormatter()

    Creates a new DefaultPassageFormatter with the default tags.

    Declaration
    public DefaultPassageFormatter()

    DefaultPassageFormatter(string, string, string, bool)

    Creates a new DefaultPassageFormatter with custom tags.

    Declaration
    public DefaultPassageFormatter(string preTag, string postTag, string ellipsis, bool escape)
    Parameters
    Type Name Description
    string preTag

    text which should appear before a highlighted term.

    string postTag

    text which should appear after a highlighted term.

    string ellipsis

    text which should be used to connect two unconnected passages.

    bool escape

    true if text should be html-escaped

    Fields

    m_ellipsis

    text that will appear between two unconnected passages

    Declaration
    protected readonly string m_ellipsis
    Field Value
    Type Description
    string

    m_escape

    true if we should escape for html

    Declaration
    protected readonly bool m_escape
    Field Value
    Type Description
    bool

    m_postTag

    text that will appear after highlighted terms

    Declaration
    protected readonly string m_postTag
    Field Value
    Type Description
    string

    m_preTag

    text that will appear before highlighted terms

    Declaration
    protected readonly string m_preTag
    Field Value
    Type Description
    string

    Methods

    Append(StringBuilder, string, int, int)

    Appends original text to the response.

    Declaration
    protected virtual void Append(StringBuilder dest, string content, int start, int end)
    Parameters
    Type Name Description
    StringBuilder dest

    resulting text, possibly transformed or encoded

    string content

    original text content

    int start

    index of the first character in content

    int end

    index of the character following the last character in content

    Format(Passage[], string)

    Formats the top passages from content into a human-readable text snippet.

    Declaration
    public override object Format(Passage[] passages, string content)
    Parameters
    Type Name Description
    Passage[] passages

    top-N passages for the field. Note these are sorted in the order that they appear in the document for convenience.

    string content

    content for the field.

    Returns
    Type Description
    object

    formatted highlight. Note that for the non-expert APIs in ICUPostingsHighlighter that return string, the ToString() method on the object returned by this method is used to compute the string.

    Overrides
    PassageFormatter.Format(Passage[], string)
    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.