3

Is there a way to get Solr to highlight the match if it includes hyphens?

In the image below, the search was 1600 and Solr highlighted the exact match. However, the search also matched on 16-00 but it was not highlighted. These are product sku's and we're trying to highlight them even if they are hyphenated.

Solr version: 5.2.1

The only setting added was hl.fl below. All the rest are not set and use the Solr defaults: <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>

Note: portions of the image were redacted. That is why the results don't line up.

enter image description here

jk.
  • 14,365
  • 4
  • 43
  • 58
  • What is your highlighting query? – MatsLindh Nov 08 '18 at 22:36
  • @matslindh The search query is `1600`. `hl.q` is not set so it is the solr default. – jk. Nov 08 '18 at 22:41
  • I'm thinking of all the hl-settings - there are multiple settings that affect how the analysis is performed. – MatsLindh Nov 09 '18 at 07:54
  • @MatsLindh Yes, there are. I looked through them and couldn't figure out which one would do the trick. Changing them involves tremendous trial and error (in this case pure shots in the dark) that with every change requires stopping and starting Solr and rebuilding the collection. – jk. Nov 09 '18 at 15:17
  • But if you don't provide your _current_ settings, its very hard to say why you get the behaviour you get - and what to correct. You usually don't have to rebuild the index itself (or start and stop Solr - reloading the core should do the trick). I can also recommend testing on a much smaller dataset when experimenting instead of the complete set of documents. – MatsLindh Nov 09 '18 at 18:13
  • @MatsLindh Current settings are basic. `hl.q` is not set so it uses the default. `hl.fl` is `summary title ` and that's all. – jk. Nov 09 '18 at 18:17

0 Answers0