This chapter covers
- Highlighting query terms in search results
- Selecting the best snippets to display for each search result
- Refining highlighting behavior using optional parameters
- Improving highlighting performance using FastVectorHighlighter
- Using Solr’s newest highlighter implementation, PostingsHighlighter
In this chapter, we introduce a core Solr feature, hit highlighting, in which query terms are highlighted in search results. Hit highlighting helps users quickly scan results to determine which results are worth investigating further, or whether they should navigate to the next page, or even issue a different query.
To have a little fun while learning about hit highlighting, we use a dataset containing thousands of unidentified flying object (UFO) sightings from across the United States, collected into a free dataset provided by Infochimps (www.infochimps.com/datasets/60000-documented-ufo-sightings-with-text-descriptions-and-metada). Our UFO search application allows users to type in a few keywords about a sighting and see if there have been similar sightings.