By default, Solr highlights searched terms in the summary content as described in the following snippet:
<cfsearch |
To highlight contents in the entire document, modify the solrconfig.xml and schema.xml files. These files are available in the following locations:
- <Collection Directory>/conf: Modify files in this location to apply the changes to all future Solr collections.
- <Solr Home>/multicore/template/conf: Modify files in this location to apply the changes only to a particular collection.
- Stop ColdFusion 11 Add-on service.
Replace the following section in the solrconfig.xml
<requestHandler name="standard" class="solr.StandardRequestHandler" default="true">
<!-- default values for query parameters -->
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="hl.fl">summary title </str>
<!-- omp = Only More Popular -->
<str name="spellcheck.onlyMorePopular">false</str>
<!-- exr = Extended Results -->
<str name="spellcheck.extendedResults">false</str>
<!-- The number of suggestions to return -->
<str name="spellcheck.count">1</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>with
<requestHandler name="standard" class="solr.StandardRequestHandler" default="true">
<!-- default values for query parameters -->
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="hl.fl">contents title </str>
<!-- omp = Only More Popular -->
<str name="spellcheck.onlyMorePopular">false</str>
<!-- exr = Extended Results -->
<str name="spellcheck.extendedResults">false</str>
<!-- The number of suggestions to return -->
<str name="spellcheck.count">1</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>Replace the following section in the schema.xml
<field name="contents" type="text" indexed="true" stored="false" required="false" multiValued="true" omitNorms="true"/>
with
<field name="contents" type="text" indexed="true" stored="true" required="false" multiValued="true" omitNorms="true"/>
- Restart Solr.
Reindex the collection.
Note: The modifications to solrconfig.xml and schema.xml will increase the index size.