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.

aggregated into single hit into parent with<br />

id=1. The key components of the request are:<br />

url part<br />

/bjqfacet<br />

q={!parent ...}..<br />

child.facet.field=...<br />

meaning<br />

The name of the request handler that has been defined with one of block join<br />

facet components enabled.<br />

The mandatory parent query as a main query. The parent query could also be a<br />

subordinate clause in a more complex query.<br />

The child document field, which might be repeated many times with several<br />

fields, as necessary.<br />

Highlighting<br />

Highlighting in <strong>Solr</strong> allows fragments of documents that match the user's query to be included with the query<br />

response. The fragments are included in a special section of the response (the highlighting section), and the<br />

client uses the formatting clues also included to determine how to present the snippets to users.<br />

<strong>Solr</strong> provides a collection of highlighting utilities which allow a great deal of control over the fields fragments are<br />

taken from, the size of fragments, and how they are formatted. The highlighting utilities can be called by various<br />

Request Handlers and can be used with the DisMax, Extended DisMax, or standard query parsers.<br />

There are three highlighting implementations available:<br />

Standard Highlighter: The Standard Highlighter is the swiss-army knife of the highlighters. It has the<br />

most sophisticated and fine-grained query representation of the three highlighters. For example, this<br />

highlighter is capable of providing precise matches even for advanced queryparsers such as the surroun<br />

d parser. It does not require any special datastructures such as termVectors, although it will use them if<br />

they are present. If they are not, this highlighter will re-analyze the document on-the-fly to highlight it. This<br />

highlighter is a good choice for a wide variety of search use-cases.<br />

FastVector Highlighter: The FastVector Highlighter requires term vector options ( termVectors,<br />

termP<br />

ositions, and termOffsets) on the field, and is optimized with that in mind. It tends to work better for<br />

more languages than the Standard Highlighter, because it supports Unicode breakiterators. On the other<br />

hand, its query-representation is less advanced than the Standard Highlighter: for example it will not work<br />

well with the surround parser. This highlighter is a good choice for large documents and highlighting text<br />

in a variety of languages.<br />

Postings Highlighter: The Postings Highlighter requires storeOffsetsWithPositions to be<br />

configured on the field. This is a much more compact and efficient structure than term vectors, but is not<br />

appropriate for huge numbers of query terms (e.g. wildcard queries). Like the FastVector Highlighter, it<br />

supports Unicode algorithms for dividing up the document. On the other hand, it has the most coarse<br />

query-representation: it focuses on summary quality and ignores the structure of the query completely,<br />

ranking passages based solely on query terms and statistics. This highlighter a good choice for classic<br />

full-text keyword search.<br />

Configuring Highlighting<br />

The configuration for highlighting, whichever implementation is chosen, is first to configure a search component<br />

and then reference the component in one or more request handlers.<br />

The exact parameters for the search component vary depending on the implementation, but there is a robust<br />

example in the solrconfig.xml used in the " techproducts" example which shows how to configure both<br />

the Standard Highlighter and the FastVector Highlighter (see the Postings Highlighter section for details on how<br />

to configure that implementation).<br />

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

314

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

Saved successfully!

Ooh no, something went wrong!