11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

hl.fragmentsBuilder default The fragments builder is responsible for formatting<br />

the fragments, which uses and markup<br />

(if hl.tag.pre and hl.tag.post are not<br />

defined). Another pre-configured choice is colored,<br />

which is an example of how to use the fragments<br />

builder to insert HTML into the snippets for colored<br />

highlights if you choose. You can also implement<br />

your own if you'd like. You can select a fragments<br />

builder with this parameter, or modify an existing<br />

implementation in solrconfig.xml to be the<br />

default by adding "default=true".<br />

Using Boundary Scanners with the Fast Vector Highlighter<br />

The Fast Vector Highlighter will occasionally truncate highlighted words. To prevent this, implement a boundary<br />

scanner in solrconfig.xml, then use the hl.boundaryScanner parameter to specify the boundary scanner<br />

for highlighting.<br />

<strong>Solr</strong> supports two boundary scanners: breakIterator and simple.<br />

The breakIterator Boundary Scanner<br />

The breakIterator boundary scanner offers excellent performance right out of the box by taking locale and<br />

boundary type into account. In most cases you will want to use the breakIterator boundary scanner. To<br />

implement the breakIterator boundary scanner, add this code to the highlighting section of your solrc<br />

onfig.xml file, adjusting the type, language, and country values as appropriate to your application:<br />

<br />

<br />

WORD<br />

en<br />

US<br />

<br />

<br />

Possible values for the hl.bs.type parameter are WORD, LINE, SENTENCE, and CHARACTER.<br />

The simple Boundary Scanner<br />

The simple boundary scanner scans term boundaries for a specified maximum character value ( hl.bs.maxSc<br />

an) and for common delimiters such as punctuation marks ( hl.bs.chars). The simple boundary scanner may<br />

be useful for some custom To implement the simple boundary scanner, add this code to the highlighting se<br />

ction of your solrconfig.xml file, adjusting the values as appropriate to your application:<br />

<br />

<br />

10<br />

.,!?\t\n<br />

<br />

<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

320

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!