Quantcast
Channel: Search Smith » Solr
Viewing all articles
Browse latest Browse all 10

Solr: Knowing which fields match

$
0
0

How do you know which fields match your query? For example, if we search our articles index for “malaria,” and we want to know whether we matched the term in title, description, and/or journal_name, how do we go about doing that?

The answer is to turn on highlighting for those fields: hl=on&hl.fl=title,description,journal_name . Solr will return a highlighting structure containing the unique keys for each record match, along with the field that matched and a snippet of that field’s contents with the matching text highlighted. N.B.: Fields to be highlighted must be stored, but not actually indexed. How cool is that?


Viewing all articles
Browse latest Browse all 10

Trending Articles