: Thanks for the reply. I'm curious why we want to search one field but
: highlight different fields? Doesn't it make more sense to only highlight

consider a typical use case: you have an index of articles with
fields for the title, description, and body of the article.  you search
all of them, but on the search results page you only highlight matches in
the title and description (maybe you have a "cached" view of each article
where you display the stored contents of the article body with
highlighting)

: the query fields? In my example, if I search f1, f2, f3, most likely I
: course I can use hl.fl, but I think it make more sense for solr to
: automatically highlight those fields(rather than the default search
: field) for us.

that wasn't actually your example .. you weren't searching across fields
f1, f2 and f3; you were searching for words in the default field
("searchall") that happened to be made by combining the text from f1, f2,
and f3 using copyField.  As Mike pointed out, if you use dismax to
*really* search for your input in f1, f2, and f3 (using the qf param) then
Solr will highlight those fields for you.

you may be wondering about what happens when you do a search like...
   http://localhost:8983/solr/select?q=features%3Asolr&hl=on
...ie: your query string explicitly looks for solr in the field features.

Solr doesn't "guess" that you want to highlight the features field in this
case, it could -- but it would be a bad idea.  The hl.fl default
"guessing" logic is independent of the fields that appear in the query
string ... if you were relying on SOlr to highlight your default search
field for you so you could display it in your application, you wouldn't be
very happy if your application broke because someone happend to do a field
specific query.

-Hoss

Reply via email to