blob: cad4f4a83a5cd721ee95f1ab052ee63f569211d8 [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Class ICUPostingsHighlighter
| Apache Lucene.NET 4.8.0-beta00010 Documentation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class ICUPostingsHighlighter
| Apache Lucene.NET 4.8.0-beta00010 Documentation ">
<meta name="generator" content="docfx 2.56.0.0">
<link rel="shortcut icon" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/favicon.ico">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.css">
<meta property="docfx:navrel" content="toc.html">
<meta property="docfx:tocrel" content="icu/toc.html">
<meta property="docfx:rel" content="https://lucenenet.apache.org/docs/4.8.0-beta00009/">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">
<img id="logo" class="svg" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/lucene-net-color.png" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search">
<ul class="level0 breadcrumb">
<li>
<a href="https://lucenenet.apache.org/docs/4.8.0-beta00009/">API</a>
<span id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</span>
</li>
</ul>
</div>
</div>
</header>
<div class="container body-content">
<div id="search-results">
<div class="search-list"></div>
<div class="sr-items">
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
</div>
<ul id="pagination"></ul>
</div>
</div>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter">
<h1 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter" class="text-break">Class ICUPostingsHighlighter
</h1>
<div class="markdown level0 summary"><p>Simple highlighter that does not analyze fields nor use
term vectors. Instead it requires
<a class="xref" href="http://localhost:8080/api/core/Lucene.Net.Index.IndexOptions.html#Lucene_Net_Index_IndexOptions_DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS">DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS</a>.</p>
</div>
<div class="markdown level0 conceptual"></div>
<div class="inheritance">
<h5>Inheritance</h5>
<div class="level0"><span class="xref">System.Object</span></div>
<div class="level1"><span class="xref">ICUPostingsHighlighter</span></div>
</div>
<div class="inheritedMembers">
<h5>Inherited Members</h5>
<div>
<span class="xref">System.Object.Equals(System.Object)</span>
</div>
<div>
<span class="xref">System.Object.Equals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.GetHashCode()</span>
</div>
<div>
<span class="xref">System.Object.GetType()</span>
</div>
<div>
<span class="xref">System.Object.MemberwiseClone()</span>
</div>
<div>
<span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.ToString()</span>
</div>
</div>
<h6><strong>Namespace</strong>: <a class="xref" href="Lucene.Net.Search.PostingsHighlight.html">Lucene.Net.Search.PostingsHighlight</a></h6>
<h6><strong>Assembly</strong>: Lucene.Net.ICU.dll</h6>
<h5 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class ICUPostingsHighlighter</code></pre>
</div>
<h5 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_remarks"><strong>Remarks</strong></h5>
<div class="markdown level0 remarks"><p>PostingsHighlighter treats the single original document as the whole corpus, and then scores individual
passages as if they were documents in this corpus. It uses a <span class="xref">ICU4N.Text.BreakIterator</span> to find
passages in the text; by default it breaks using <span class="xref">ICU4N.Text.BreakIterator.GetSentenceInstance(System.Globalization.CultureInfo)</span> (for sentence breaking).
It then iterates in parallel (merge sorting by offset) through
the positions of all terms from the query, coalescing those hits that occur in a single passage
into a <a class="xref" href="Lucene.Net.Search.PostingsHighlight.Passage.html">Passage</a>, and then scores each Passage using a separate <a class="xref" href="Lucene.Net.Search.PostingsHighlight.PassageScorer.html">PassageScorer</a>.
Passages are finally formatted into highlighted snippets with a <a class="xref" href="Lucene.Net.Search.PostingsHighlight.PassageFormatter.html">PassageFormatter</a>.
<p>
You can customize the behavior by subclassing this highlighter, some important hooks:
<ul><li><a class="xref" href="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.html#Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetBreakIterator_System_String_">GetBreakIterator(String)</a>: Customize how the text is divided into passages.</li><li><a class="xref" href="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.html#Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetScorer_System_String_">GetScorer(String)</a>: Customize how passages are ranked.</li><li><a class="xref" href="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.html#Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetFormatter_System_String_">GetFormatter(String)</a>: Customize how snippets are formatted.</li><li><a class="xref" href="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.html#Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetIndexAnalyzer_System_String_">GetIndexAnalyzer(String)</a>: Enable highlighting of MultiTermQuerys such as <a class="xref" href="http://localhost:8080/api/core/Lucene.Net.Search.WildcardQuery.html">WildcardQuery</a>.</li></ul>
<p>
<strong>WARNING</strong>: The code is very new and probably still has some exciting bugs!
<p>
Example usage:</p>
<pre><code> // configure field with offsets at index time
IndexableFieldType offsetsType = new IndexableFieldType(TextField.TYPE_STORED);
offsetsType.IndexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
Field body = new Field(&quot;body&quot;, &quot;foobar&quot;, offsetsType);
// retrieve highlights at query time
ICUPostingsHighlighter highlighter = new ICUPostingsHighlighter();
Query query = new TermQuery(new Term(&quot;body&quot;, &quot;highlighting&quot;));
TopDocs topDocs = searcher.Search(query, n);
string highlights[] = highlighter.Highlight(&quot;body&quot;, query, searcher, topDocs);</code></pre>
<p><p>
This is thread-safe, and can be used across different readers.
<p>
Note that the .NET implementation differs from the <code>PostingsHighlighter</code> in Lucene in
that it is backed by an ICU <span class="xref">ICU4N.Text.RuleBasedBreakIterator</span>, which differs slightly in default behavior
than the one in the JDK. However, the ICU <span class="xref">ICU4N.Text.RuleBasedBreakIterator</span> behavior can be customized
to meet a lot of scenarios that the one in the JDK cannot. See the ICU documentation at
<a href="http://userguide.icu-project.org/boundaryanalysis/break-rules">http://userguide.icu-project.org/boundaryanalysis/break-rules</a>
for more information how to pass custom rules to an ICU <span class="xref">ICU4N.Text.RuleBasedBreakIterator</span>.
<p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></div>
<h3 id="constructors">Constructors
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter__ctor.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.%23ctor%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L118">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter__ctor_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.#ctor*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter__ctor" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.#ctor">ICUPostingsHighlighter()</h4>
<div class="markdown level1 summary"><p>Creates a new highlighter with <a class="xref" href="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.html#Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_DEFAULT_MAX_LENGTH">DEFAULT_MAX_LENGTH</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public ICUPostingsHighlighter()</code></pre>
</div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter__ctor_System_Int32_.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.%23ctor(System.Int32)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L128">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter__ctor_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.#ctor*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter__ctor_System_Int32_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.#ctor(System.Int32)">ICUPostingsHighlighter(Int32)</h4>
<div class="markdown level1 summary"><p>Creates a new highlighter, specifying maximum content length.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public ICUPostingsHighlighter(int maxLength)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">maxLength</span></td>
<td><p>maximum content size to process.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.ArgumentException</span></td>
<td><p>if <code data-dev-comment-type="paramref" class="paramref">maxLength</code> is negative or <code>int.MaxValue</code></p>
</td>
</tr>
</tbody>
</table>
<h3 id="fields">Fields
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_DEFAULT_MAX_LENGTH.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.DEFAULT_MAX_LENGTH%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L100">View Source</a>
</span>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_DEFAULT_MAX_LENGTH" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.DEFAULT_MAX_LENGTH">DEFAULT_MAX_LENGTH</h4>
<div class="markdown level1 summary"><p>Default maximum content size to process. Typically snippets
closer to the beginning of the document better summarize its content</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static readonly int DEFAULT_MAX_LENGTH</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="methods">Methods
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetBreakIterator_System_String_.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetBreakIterator(System.String)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L145">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetBreakIterator_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetBreakIterator*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetBreakIterator_System_String_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetBreakIterator(System.String)">GetBreakIterator(String)</h4>
<div class="markdown level1 summary"><p>Returns the <span class="xref">ICU4N.Text.BreakIterator</span> to use for
dividing text into passages. This instantiates an
<span class="xref">ICU4N.Text.BreakIterator.GetSentenceInstance(System.Globalization.CultureInfo)</span> by default;
subclasses can override to customize.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected virtual BreakIterator GetBreakIterator(string field)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">field</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">ICU4N.Text.BreakIterator</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetEmptyHighlight_System_String_ICU4N_Text_BreakIterator_System_Int32_.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetEmptyHighlight(System.String%2CICU4N.Text.BreakIterator%2CSystem.Int32)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L763">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetEmptyHighlight_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetEmptyHighlight*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetEmptyHighlight_System_String_ICU4N_Text_BreakIterator_System_Int32_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetEmptyHighlight(System.String,ICU4N.Text.BreakIterator,System.Int32)">GetEmptyHighlight(String, BreakIterator, Int32)</h4>
<div class="markdown level1 summary"><p>Called to summarize a document when no hits were
found. By default this just returns the first
<code data-dev-comment-type="paramref" class="paramref">maxPassages</code> sentences; subclasses can override
to customize.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected virtual Passage[] GetEmptyHighlight(string fieldName, BreakIterator bi, int maxPassages)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">fieldName</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">ICU4N.Text.BreakIterator</span></td>
<td><span class="parametername">bi</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">maxPassages</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Search.PostingsHighlight.Passage.html">Passage</a>[]</td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetFormatter_System_String_.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetFormatter(System.String)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L156">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetFormatter_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetFormatter*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetFormatter_System_String_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetFormatter(System.String)">GetFormatter(String)</h4>
<div class="markdown level1 summary"><p>Returns the <a class="xref" href="Lucene.Net.Search.PostingsHighlight.PassageFormatter.html">PassageFormatter</a> to use for
formatting passages into highlighted snippets. This
returns a new <a class="xref" href="Lucene.Net.Search.PostingsHighlight.PassageFormatter.html">PassageFormatter</a> by default;
subclasses can override to customize.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected virtual PassageFormatter GetFormatter(string field)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">field</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Search.PostingsHighlight.PassageFormatter.html">PassageFormatter</a></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetIndexAnalyzer_System_String_.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetIndexAnalyzer(System.String)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L494">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetIndexAnalyzer_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetIndexAnalyzer*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetIndexAnalyzer_System_String_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetIndexAnalyzer(System.String)">GetIndexAnalyzer(String)</h4>
<div class="markdown level1 summary"><p>Returns the analyzer originally used to index the content for <code data-dev-comment-type="paramref" class="paramref">field</code>.
<p>
This is used to highlight some <a class="xref" href="http://localhost:8080/api/core/Lucene.Net.Search.MultiTermQuery.html">MultiTermQuery</a>s.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected virtual Analyzer GetIndexAnalyzer(string field)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">field</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">Lucene.Net.Analysis.Analyzer</span></td>
<td><p><span class="xref">Lucene.Net.Analysis.Analyzer</span> or null (the default, meaning no special multi-term processing)</p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetMultiValuedSeparator_System_String_.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetMultiValuedSeparator(System.String)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L482">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetMultiValuedSeparator_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetMultiValuedSeparator*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetMultiValuedSeparator_System_String_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetMultiValuedSeparator(System.String)">GetMultiValuedSeparator(String)</h4>
<div class="markdown level1 summary"><p>Returns the logical separator between values for multi-valued fields.
The default value is a space character, which means passages can span across values,
but a subclass can override, for example with <code>U+2029 PARAGRAPH SEPARATOR (PS)</code>
if each value holds a discrete passage for highlighting.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected virtual char GetMultiValuedSeparator(string field)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">field</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Char</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetScorer_System_String_.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetScorer(System.String)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L171">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetScorer_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetScorer*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_GetScorer_System_String_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.GetScorer(System.String)">GetScorer(String)</h4>
<div class="markdown level1 summary"><p>Returns the <a class="xref" href="Lucene.Net.Search.PostingsHighlight.PassageScorer.html">PassageScorer</a> to use for
ranking passages. This
returns a new <a class="xref" href="Lucene.Net.Search.PostingsHighlight.PassageScorer.html">PassageScorer</a> by default;
subclasses can override to customize.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected virtual PassageScorer GetScorer(string field)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">field</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Search.PostingsHighlight.PassageScorer.html">PassageScorer</a></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_Highlight_System_String_Lucene_Net_Search_Query_Lucene_Net_Search_IndexSearcher_Lucene_Net_Search_TopDocs_.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.Highlight(System.String%2CLucene.Net.Search.Query%2CLucene.Net.Search.IndexSearcher%2CLucene.Net.Search.TopDocs)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L194">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_Highlight_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.Highlight*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_Highlight_System_String_Lucene_Net_Search_Query_Lucene_Net_Search_IndexSearcher_Lucene_Net_Search_TopDocs_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.Highlight(System.String,Lucene.Net.Search.Query,Lucene.Net.Search.IndexSearcher,Lucene.Net.Search.TopDocs)">Highlight(String, Query, IndexSearcher, TopDocs)</h4>
<div class="markdown level1 summary"><p>Highlights the top passages from a single field.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual string[] Highlight(string field, Query query, IndexSearcher searcher, TopDocs topDocs)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">field</span></td>
<td><p>field name to highlight. Must have a stored string value and also be indexed with offsets.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.Query</span></td>
<td><span class="parametername">query</span></td>
<td><p>query to highlight.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.IndexSearcher</span></td>
<td><span class="parametername">searcher</span></td>
<td><p>searcher that was previously used to execute the query.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.TopDocs</span></td>
<td><span class="parametername">topDocs</span></td>
<td><p>TopDocs containing the summary result documents to highlight.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span>[]</td>
<td><p>Array of formatted snippets corresponding to the documents in <code data-dev-comment-type="paramref" class="paramref">topDocs</code>.
If no highlights were found for a document, the
first sentence for the field will be returned.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if an I/O error occurred during processing</p>
</td>
</tr>
<tr>
<td><span class="xref">System.ArgumentException</span></td>
<td><p>if <code data-dev-comment-type="paramref" class="paramref">field</code> was indexed without <a class="xref" href="http://localhost:8080/api/core/Lucene.Net.Index.IndexOptions.html#Lucene_Net_Index_IndexOptions_DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS">DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS</a></p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_Highlight_System_String_Lucene_Net_Search_Query_Lucene_Net_Search_IndexSearcher_Lucene_Net_Search_TopDocs_System_Int32_.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.Highlight(System.String%2CLucene.Net.Search.Query%2CLucene.Net.Search.IndexSearcher%2CLucene.Net.Search.TopDocs%2CSystem.Int32)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L218">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_Highlight_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.Highlight*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_Highlight_System_String_Lucene_Net_Search_Query_Lucene_Net_Search_IndexSearcher_Lucene_Net_Search_TopDocs_System_Int32_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.Highlight(System.String,Lucene.Net.Search.Query,Lucene.Net.Search.IndexSearcher,Lucene.Net.Search.TopDocs,System.Int32)">Highlight(String, Query, IndexSearcher, TopDocs, Int32)</h4>
<div class="markdown level1 summary"><p>Highlights the top-N passages from a single field.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual string[] Highlight(string field, Query query, IndexSearcher searcher, TopDocs topDocs, int maxPassages)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td><span class="parametername">field</span></td>
<td><p>field name to highlight.
Must have a stored string value and also be indexed with offsets.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.Query</span></td>
<td><span class="parametername">query</span></td>
<td><p>query to highlight.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.IndexSearcher</span></td>
<td><span class="parametername">searcher</span></td>
<td><p>searcher that was previously used to execute the query.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.TopDocs</span></td>
<td><span class="parametername">topDocs</span></td>
<td><p>TopDocs containing the summary result documents to highlight.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">maxPassages</span></td>
<td><p>The maximum number of top-N ranked passages used to form the highlighted snippets.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span>[]</td>
<td><p>Array of formatted snippets corresponding to the documents in <code data-dev-comment-type="paramref" class="paramref">topDocs</code>.
If no highlights were found for a document, the
first <code data-dev-comment-type="paramref" class="paramref">maxPassages</code> sentences from the
field will be returned.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if an I/O error occurred during processing</p>
</td>
</tr>
<tr>
<td><span class="xref">System.ArgumentException</span></td>
<td><p>Illegal if <code data-dev-comment-type="paramref" class="paramref">field</code> was indexed without <a class="xref" href="http://localhost:8080/api/core/Lucene.Net.Index.IndexOptions.html#Lucene_Net_Index_IndexOptions_DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS">DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS</a></p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_HighlightFields_System_String___Lucene_Net_Search_Query_Lucene_Net_Search_IndexSearcher_Lucene_Net_Search_TopDocs_.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.HighlightFields(System.String%5B%5D%2CLucene.Net.Search.Query%2CLucene.Net.Search.IndexSearcher%2CLucene.Net.Search.TopDocs)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L251">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_HighlightFields_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.HighlightFields*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_HighlightFields_System_String___Lucene_Net_Search_Query_Lucene_Net_Search_IndexSearcher_Lucene_Net_Search_TopDocs_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.HighlightFields(System.String[],Lucene.Net.Search.Query,Lucene.Net.Search.IndexSearcher,Lucene.Net.Search.TopDocs)">HighlightFields(String[], Query, IndexSearcher, TopDocs)</h4>
<div class="markdown level1 summary"><p>Highlights the top passages from multiple fields.
<p>
Conceptually, this behaves as a more efficient form of:</p>
<pre><code>IDictionary&lt;string, string[]> m = new Dictionary&lt;string, string[]>();
foreach (string field in fields)
{
m[field] = Highlight(field, query, searcher, topDocs);
}
return m;</code></pre>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual IDictionary&lt;string, string[]&gt; HighlightFields(string[] fields, Query query, IndexSearcher searcher, TopDocs topDocs)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span>[]</td>
<td><span class="parametername">fields</span></td>
<td><p>field names to highlight. Must have a stored string value and also be indexed with offsets.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.Query</span></td>
<td><span class="parametername">query</span></td>
<td><p>query to highlight.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.IndexSearcher</span></td>
<td><span class="parametername">searcher</span></td>
<td><p>searcher that was previously used to execute the query.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.TopDocs</span></td>
<td><span class="parametername">topDocs</span></td>
<td><p>TopDocs containing the summary result documents to highlight.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.IDictionary</span>&lt;<span class="xref">System.String</span>, <span class="xref">System.String</span>[]&gt;</td>
<td><p><see cref="T:IDictionary{string, string[]}"></see> keyed on field name, containing the array of formatted snippets
corresponding to the documents in <code data-dev-comment-type="paramref" class="paramref">topDocs</code>.
If no highlights were found for a document, the
first sentence from the field will be returned.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if an I/O error occurred during processing</p>
</td>
</tr>
<tr>
<td><span class="xref">System.ArgumentException</span></td>
<td><p>if <code>field</code> was indexed without <a class="xref" href="http://localhost:8080/api/core/Lucene.Net.Index.IndexOptions.html#Lucene_Net_Index_IndexOptions_DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS">DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS</a></p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_HighlightFields_System_String___Lucene_Net_Search_Query_Lucene_Net_Search_IndexSearcher_Lucene_Net_Search_TopDocs_System_Int32___.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.HighlightFields(System.String%5B%5D%2CLucene.Net.Search.Query%2CLucene.Net.Search.IndexSearcher%2CLucene.Net.Search.TopDocs%2CSystem.Int32%5B%5D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L285">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_HighlightFields_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.HighlightFields*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_HighlightFields_System_String___Lucene_Net_Search_Query_Lucene_Net_Search_IndexSearcher_Lucene_Net_Search_TopDocs_System_Int32___" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.HighlightFields(System.String[],Lucene.Net.Search.Query,Lucene.Net.Search.IndexSearcher,Lucene.Net.Search.TopDocs,System.Int32[])">HighlightFields(String[], Query, IndexSearcher, TopDocs, Int32[])</h4>
<div class="markdown level1 summary"><p>Highlights the top-N passages from multiple fields.
<p>
Conceptually, this behaves as a more efficient form of:</p>
<pre><code>IDictionary&lt;string, string[]> m = new Dictionary&lt;string, string[]>();
foreach (string field in fields)
{
m[field] = Highlight(field, query, searcher, topDocs, maxPassages);
}
return m;</code></pre>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual IDictionary&lt;string, string[]&gt; HighlightFields(string[] fields, Query query, IndexSearcher searcher, TopDocs topDocs, int[] maxPassages)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span>[]</td>
<td><span class="parametername">fields</span></td>
<td><p>field names to highlight. Must have a stored string value and also be indexed with offsets.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.Query</span></td>
<td><span class="parametername">query</span></td>
<td><p>query to highlight.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.IndexSearcher</span></td>
<td><span class="parametername">searcher</span></td>
<td><p>searcher that was previously used to execute the query.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.TopDocs</span></td>
<td><span class="parametername">topDocs</span></td>
<td><p>TopDocs containing the summary result documents to highlight.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int32</span>[]</td>
<td><span class="parametername">maxPassages</span></td>
<td><p>The maximum number of top-N ranked passages per-field used to form the highlighted snippets.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.IDictionary</span>&lt;<span class="xref">System.String</span>, <span class="xref">System.String</span>[]&gt;</td>
<td><p><see cref="T:IDictionary{string, string[]}"></see> keyed on field name, containing the array of formatted snippets
corresponding to the documents in <code data-dev-comment-type="paramref" class="paramref">topDocs</code>.
If no highlights were found for a document, the
first <code data-dev-comment-type="paramref" class="paramref">maxPassages</code> sentences from the
field will be returned.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if an I/O error occurred during processing</p>
</td>
</tr>
<tr>
<td><span class="xref">System.ArgumentException</span></td>
<td><p>if <code>field</code> was indexed without <a class="xref" href="http://localhost:8080/api/core/Lucene.Net.Index.IndexOptions.html#Lucene_Net_Index_IndexOptions_DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS">DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS</a></p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_HighlightFields_System_String___Lucene_Net_Search_Query_Lucene_Net_Search_IndexSearcher_System_Int32___System_Int32___.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.HighlightFields(System.String%5B%5D%2CLucene.Net.Search.Query%2CLucene.Net.Search.IndexSearcher%2CSystem.Int32%5B%5D%2CSystem.Int32%5B%5D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L315">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_HighlightFields_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.HighlightFields*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_HighlightFields_System_String___Lucene_Net_Search_Query_Lucene_Net_Search_IndexSearcher_System_Int32___System_Int32___" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.HighlightFields(System.String[],Lucene.Net.Search.Query,Lucene.Net.Search.IndexSearcher,System.Int32[],System.Int32[])">HighlightFields(String[], Query, IndexSearcher, Int32[], Int32[])</h4>
<div class="markdown level1 summary"><p>Highlights the top-N passages from multiple fields,
for the provided int[] docids.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual IDictionary&lt;string, string[]&gt; HighlightFields(string[] fieldsIn, Query query, IndexSearcher searcher, int[] docidsIn, int[] maxPassagesIn)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span>[]</td>
<td><span class="parametername">fieldsIn</span></td>
<td><p>field names to highlight. Must have a stored string value and also be indexed with offsets.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.Query</span></td>
<td><span class="parametername">query</span></td>
<td><p>query to highlight.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.IndexSearcher</span></td>
<td><span class="parametername">searcher</span></td>
<td><p>searcher that was previously used to execute the query.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int32</span>[]</td>
<td><span class="parametername">docidsIn</span></td>
<td><p>containing the document IDs to highlight.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int32</span>[]</td>
<td><span class="parametername">maxPassagesIn</span></td>
<td><p>The maximum number of top-N ranked passages per-field used to form the highlighted snippets.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.IDictionary</span>&lt;<span class="xref">System.String</span>, <span class="xref">System.String</span>[]&gt;</td>
<td><p><see cref="F:IDictionary{string, string[]}"></see> keyed on field name, containing the array of formatted snippets
corresponding to the documents in <code data-dev-comment-type="paramref" class="paramref">docidsIn</code>.
If no highlights were found for a document, the
first <code>maxPassages</code> from the field will
be returned.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if an I/O error occurred during processing</p>
</td>
</tr>
<tr>
<td><span class="xref">System.ArgumentException</span></td>
<td><p>if <code>field</code> was indexed without <a class="xref" href="http://localhost:8080/api/core/Lucene.Net.Index.IndexOptions.html#Lucene_Net_Index_IndexOptions_DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS">DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS</a></p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_HighlightFieldsAsObjects_System_String___Lucene_Net_Search_Query_Lucene_Net_Search_IndexSearcher_System_Int32___System_Int32___.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.HighlightFieldsAsObjects(System.String%5B%5D%2CLucene.Net.Search.Query%2CLucene.Net.Search.IndexSearcher%2CSystem.Int32%5B%5D%2CSystem.Int32%5B%5D)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L382">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_HighlightFieldsAsObjects_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.HighlightFieldsAsObjects*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_HighlightFieldsAsObjects_System_String___Lucene_Net_Search_Query_Lucene_Net_Search_IndexSearcher_System_Int32___System_Int32___" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.HighlightFieldsAsObjects(System.String[],Lucene.Net.Search.Query,Lucene.Net.Search.IndexSearcher,System.Int32[],System.Int32[])">HighlightFieldsAsObjects(String[], Query, IndexSearcher, Int32[], Int32[])</h4>
<div class="markdown level1 summary"><p>Expert: highlights the top-N passages from multiple fields,
for the provided int[] docids, to custom object as
returned by the <a class="xref" href="Lucene.Net.Search.PostingsHighlight.PassageFormatter.html">PassageFormatter</a>. Use
this API to render to something other than <span class="xref">System.String</span>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected virtual IDictionary&lt;string, object[]&gt; HighlightFieldsAsObjects(string[] fieldsIn, Query query, IndexSearcher searcher, int[] docidsIn, int[] maxPassagesIn)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span>[]</td>
<td><span class="parametername">fieldsIn</span></td>
<td><p>field names to highlight. Must have a stored string value and also be indexed with offsets.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.Query</span></td>
<td><span class="parametername">query</span></td>
<td><p>query to highlight.</p>
</td>
</tr>
<tr>
<td><span class="xref">Lucene.Net.Search.IndexSearcher</span></td>
<td><span class="parametername">searcher</span></td>
<td><p>searcher that was previously used to execute the query.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int32</span>[]</td>
<td><span class="parametername">docidsIn</span></td>
<td><p>containing the document IDs to highlight.</p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int32</span>[]</td>
<td><span class="parametername">maxPassagesIn</span></td>
<td><p>The maximum number of top-N ranked passages per-field used to form the highlighted snippets.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.IDictionary</span>&lt;<span class="xref">System.String</span>, <span class="xref">System.Object</span>[]&gt;</td>
<td><p><see cref="T:IDictionary{string, object[]}"></see> keyed on field name, containing the array of formatted snippets
corresponding to the documents in <code data-dev-comment-type="paramref" class="paramref">docidsIn</code>.
If no highlights were found for a document, the
first <code data-dev-comment-type="paramref" class="paramref">maxPassagesIn</code> from the field will
be returned.</p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.IO.IOException</span></td>
<td><p>if an I/O error occurred during processing</p>
</td>
</tr>
<tr>
<td><span class="xref">System.ArgumentException</span></td>
<td><p>if <code>field</code> was indexed without <a class="xref" href="http://localhost:8080/api/core/Lucene.Net.Index.IndexOptions.html#Lucene_Net_Index_IndexOptions_DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS">DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS</a></p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_LoadFieldValues_Lucene_Net_Search_IndexSearcher_System_String___System_Int32___System_Int32_.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.LoadFieldValues(Lucene.Net.Search.IndexSearcher%2CSystem.String%5B%5D%2CSystem.Int32%5B%5D%2CSystem.Int32)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L455">View Source</a>
</span>
<a id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_LoadFieldValues_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.LoadFieldValues*"></a>
<h4 id="Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter_LoadFieldValues_Lucene_Net_Search_IndexSearcher_System_String___System_Int32___System_Int32_" data-uid="Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter.LoadFieldValues(Lucene.Net.Search.IndexSearcher,System.String[],System.Int32[],System.Int32)">LoadFieldValues(IndexSearcher, String[], Int32[], Int32)</h4>
<div class="markdown level1 summary"><p>Loads the string values for each field X docID to be
highlighted. By default this loads from stored
fields, but a subclass can change the source. This
method should allocate the string[fields.length][docids.length]
and fill all values. The returned strings must be
identical to what was indexed.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected virtual IList&lt;string[]&gt; LoadFieldValues(IndexSearcher searcher, string[] fields, int[] docids, int maxLength)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">Lucene.Net.Search.IndexSearcher</span></td>
<td><span class="parametername">searcher</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.String</span>[]</td>
<td><span class="parametername">fields</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Int32</span>[]</td>
<td><span class="parametername">docids</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Int32</span></td>
<td><span class="parametername">maxLength</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.Generic.IList</span>&lt;<span class="xref">System.String</span>[]&gt;</td>
<td></td>
</tr>
</tbody>
</table>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00010/websites/apidocs/apiSpec/new?filename=Lucene_Net_Search_PostingsHighlight_ICUPostingsHighlighter.md&amp;value=---%0Auid%3A%20Lucene.Net.Search.PostingsHighlight.ICUPostingsHighlighter%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
</li>
<li>
<a href="https://github.com/apache/lucenenet/blob/release/Lucene.Net_4_8_0_beta00010/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs/#L86" class="contribution-link">View Source</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
Copyright © 2020 Licensed to the Apache Software Foundation (ASF)
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.js"></script>
</body>
</html>