You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by "Cassandra Targett (Confluence)" <co...@apache.org> on 2013/09/13 17:02:00 UTC
[CONF] Apache Solr Reference Guide > Standard Highlighter
Space: Apache Solr Reference Guide (https://cwiki.apache.org/confluence/display/solr)
Page: Standard Highlighter (https://cwiki.apache.org/confluence/display/solr/Standard+Highlighter)
Change Comment:
---------------------------------------------------------------------
improved the table of params
Edited by Cassandra Targett:
---------------------------------------------------------------------
The standard highlighter doesn't require any special indexing parameters on the fields to highlight, however you can optionally turn on {{termVectors}}, {{termPositions}}, and {{termOffsets}} for each field to be highlighted. This will avoid having to run documents through the analysis chain at query-time and should make highlighting faster.
h2. Standard Highlighting Parameters
The table below describes Solr's parameters for the Standard highlighter. These parameters can be defined in the highlight search component, as defaults for the specific request handler, or passed to the request handler with the query.
|| Parameter || Default Value || Description ||
| hl | blank (no highlight) | When set to *true*, enables highlighted snippets to be generated in the query response. If set to *false* or to a blank or missing value, disables highlighting. |
| hl.q | blank | Specifies an overriding query term for highlighting. If {{hl.q}} is specified, the highlighter will use that term rather than the main query term. |
| hl.fl | blank | Specifies a list of fields to highlight. Accepts a comma\- or space-delimited list of fields for which Solr should generate highlighted snippets. If left blank, highlights the defaultSearchField (or the field specified the {{df}} parameter if used) for the StandardRequestHandler. For the DisMaxRequestHandler, the {{qf}} fields are used as defaults. \\
\\
A '\*' can be used to match field globs, such as 'text_\*' or even '\*' to highlight on all fields where highlighting is possible. When using '\*', consider adding {{hl.requireFieldMatch=true}}. |
| hl.snippets | 1 | Specifies maximum number of highlighted snippets to generate per field. It is possible for any number of snippets from zero to this value to be generated. This parameter accepts per-field overrides. |
| hl.fragsize | 100 | Specifies the size, in characters, of fragments to consider for highlighting. "0" indicates that no fragmenting should be considered and the whole field value should be used. This parameter accepts per-field overrides. |
| hl.mergeContinuous | false | Instructs Solr to collapse contiguous fragments into a single fragment. A value of *true* indicates contiguous fragments will be collapsed into single fragment. This parameter accepts per-field overrides. The default value, *false*, is also the backward-compatible setting. |
| hl.requireFieldMatch | false | If set to *true*, highlights terms only if they appear in the specified field. If *false*, terms are highlighted in all requested fields regardless of which field matched the query. |
| hl.maxAnalyzedChars | 51200 | Specifies the number of characters into a document that Solr should look for suitable snippets. |
| hl.maxMultiValuedToExamine | {{integer.MAX_VALUE}} | Specifies the maximum number of entries in a multi-valued field to examine before stopping. This can potentially return zero results if the limit is reached before any matches are found. If used with the {{maxMultiValuedToMatch}}, whichever limit is reached first will determine when to stop looking. |
| hl.maxMultiValuedToMatch | {{integer.MAX_VALUE}} | Specifies the maximum number of matches in a multi-valued field that are found before stopping. If {{hl.maxMultiValuedToExamine}} is also defined, whichever limit is reached first will determine when to stop looking. |
| hl.alternateField | blank | Specifies a field to be used as a backup default summary if Solr cannot generate a snippet (i.e., because no terms match). This parameter accepts per-field overrides. |
| hl.maxAlternateFieldLength | unlimited | Specifies the maximum number of characters of the field to return. Any value less than or equal to 0 means the field's length is unlimited. This parameter is only used in conjunction with the {{hl.alternateField}} parameter. |
| hl.formatter | simple | Selects a formatter for the highlighted output. Currently the only legal value is *simple*, which surrounds a highlighted term with a customizable pre\- and post-text snippet. This parameter accepts per-field overrides. |
| hl.simple.pre\\
hl.simple.post | <em> and </em> | Specifies the text that should appear before ({{hl.simple.pre}}) and after ({{hl.simple.post}}) a highlighted term, when using the simple formatter. This parameter accepts per-field overrides. |
| hl.fragmenter | gap | Specifies a text snippet generator for highlighted text. The standard fragmenter is *gap*, which creates fixed-sized fragments with gaps for multi-valued fields. Another option is *regex*, which tries to create fragments that resemble a specified regular expression. This parameter accepts per-field overrides. |
| hl.usePhraseHighlighter | true | If set to *true*, Solr will use the Lucene SpanScorer class to highlight phrase terms only when they appear within the query phrase in the document. |
| hl.highlightMultiTerm | true | If set to *true*, Solr will use highlight phrase terms that appear in multi-term queries. |
| hl.regex.slop | 0.6 | When using the regex fragmenter ({{hl.fragmenter=regex}}), this parameter defines the factor by which the fragmenter can stray from the ideal fragment size (given by {{hl.fragsize}}) to accommodate a regular expression. For instance, a slop of 0.2 with {{hl.fragsize=100}} should yield fragments between 80 and 120 characters in length.\\
\\
It is usually good to provide a slightly smaller {{hl.fragsize}} value when using the regex fragmenter. |
| hl.regex.pattern | blank | Specifies the regular expression for fragmenting. This could be used to extract sentences. |
| hl.regex.maxAnalyzedChars | 10000 | Instructs Solr to analyze only this many characters from a field when using the regex fragmenter (after which, the fragmenter produces fixed-sized fragments). Applying a complicated regex to a huge field is computationally expensive. |
| hl.preserveMulti | false | If *true*, multi-valued fields will return all values in the order they were saved in the index. If *false*, only values that match the highlight request will be returned. |
{scrollbar}
Stop watching space: https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=solr
Change email notification preferences: https://cwiki.apache.org/confluence/users/editmyemailsettings.action