projectblacklight / blacklight

Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr) index.
http://projectblacklight.org/
Other
757 stars 256 forks source link

[highlight] Activating highlight: true for specific fields will hide the field if the search doesn't find a match in the specific field #3100

Closed christinach closed 8 months ago

christinach commented 8 months ago

Steps to replicate: In solrconf.xml:

<str name="hl">true</str>
<str name="hl.method">unified</str>
<str name="hl.fl">author_tsim title_tsim</str>
 <str name="hl.snippets">2</str>

In catalog_controller.rb

config.add_index_field 'title_tsim', label: 'Title', highlight: true
config.add_index_field 'author_tsim', label: 'Author', highlight: true

docker compose down docker compose up -d solr rake blacklight:index:seed

visit: Blacklight url Search for nectar will return a result with the emphasized title. The title displays. The author does not display.