HighlightingParameters

Solr provides a collection of [WWW] Highlighting Utilities which can be reused by various Request Handlers to include "highlighted" matches in field values. Both the StandardRequestHandler and the DisMaxRequestHandler currently use these utilities, and support the following parameters.

Some parameters may be overriden on a per-field basis with the following syntax:

eg. f.contents.hl.snippets=2

  1. hl
  2. hl.fl
  3. hl.snippets
  4. hl.fragsize
  5. hl.mergeContiguous
  6. hl.requireFieldMatch
  7. hl.maxAnalyzedChars
  8. hl.alternateField
  9. hl.maxAlternateFieldLength
  10. hl.formatter
  11. hl.simple.pre/hl.simple.post
  12. hl.fragmenter
  13. hl.usePhraseHighlighter
  14. hl.regex.slop
  15. hl.regex.pattern
  16. hl.regex.maxAnalyzedChars

hl

Set to "true" enable highlighted snippets to be generated in the query response. Any blank or missing value, or "false" will disable highlighting.

The default value is blank.

hl.fl

A comma- or space- delimited list of fields to generate highlighted snippets for. If left blank, the fields highlighted for the StandardRequestHandler are the defaultSearchField (or the df param if used) and for the DisMaxRequestHandler the qf fields are used.

The default value is blank.

hl.snippets

The maximum number of highlighted snippets to generate per field. Note: it is possible for any number of snippets from zero to this value to be generated. This parameter accepts per-field overrides.

The default value is "1".

hl.fragsize

The size, in characters, of fragments to consider for highlighting. "0" indicates that the whole field value should be used (no fragmenting). This parameter accepts per-field overrides.

The default value is "100".

hl.mergeContiguous

Collapse contiguous fragments into a single fragment. "true" indicates contiguous fragments will be collapsed into single fragment. This parameter accepts per-field overrides.

The default value is "false", which is also the backward-compatible setting. <!> Solr1.3.

hl.requireFieldMatch

If true, then a field will only be highlighted if the query matched in this particular field (normally, terms are highlighted in all requested fields regardless of which field matched the query).

The default value is "false".

hl.maxAnalyzedChars

How many characters into a document to look for suitable snippets <!> Solr1.3.

The default value is "51200".

hl.alternateField

If a snippet cannot be generated (due to no terms matching), you can specify a field to use as the backup/default summary. This parameter accepts per-field overrides <!> Solr1.3.

The default value is to not have a default summary.

hl.maxAlternateFieldLength

If hl.alternateField is specified, this parameter specifies the maximum number of characters of the field to return <!> Solr1.3. Any value less than or equal to 0 means unlimited.

The default value is unlimited.

hl.formatter

Specify a formatter for the highlight 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.

The default value is "simple".

hl.simple.pre/hl.simple.post

The text which appears before and after a highlighted term when using the simple formatter. This parameter accepts per-field overrides.

The default values are "<em>" and "</em>"

hl.fragmenter

Specify a text snippet generator for highlighted text. The standard fragmenter is gap (which is so called because it creates fixed-sized fragments with gaps for multi-valued fields). Another option is regex, which tries to create fragments that "look like" a certain regular expression. <!> Solr1.3

The default value is "gap"

hl.usePhraseHighlighter

Use SpanScorer to highlight phrase terms only when they appear within the query phrase in the document. Default is false. <!> Solr1.3.

hl.regex.slop

Factor by which the regex fragmenter can stray from the ideal fragment size (given by hl.fragsize) to accomodate the regular expression. For instance, a slop of 0.2 with fragsize of 100 should yield fragments between 80 and 120 characters in length. It is usually good to provide a slightly smaller fragsize when using the regex fragmenter.

The default value is ".6"

hl.regex.pattern

The regular expression for fragmenting. This could be used to extract sentences (see example solrconfig.xml)

hl.regex.maxAnalyzedChars

Only analyze 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 expensive.

The default value is "10000".

last edited 2008-05-23 21:27:23 by OtisGospodnetic