DocumentHighlighter class

DocumentHighlighter class

Represents a search result highlighter that highlights search results in an entire document text.

Learn more

The DocumentHighlighter type exposes the following members:

Constructors

Constructor Description
init Initializes a new DocumentHighlighter.

Properties

Property Description
output_adapter The output adapter passed in the constructor.
output_format The output format. (inherited from ResultBuilderFactory)

Example

from groupdocs.search import Index
from groupdocs.search.common import FileOutputAdapter
from groupdocs.search.highlighters import DocumentHighlighter
from groupdocs.search.options import OutputFormat

index = Index("./index")
index.add("./documents")
result = index.search("Einstein")

if result.document_count > 0:
    adapter = FileOutputAdapter(OutputFormat.HTML, "./output/Highlighted.html")
    highlighter = DocumentHighlighter(adapter)
    index.highlight(result.get_found_document(0), highlighter)

Guides

Task guides that use DocumentHighlighter:

See Also