Page 1 of 1

Top Navigation Search highlighting

Posted: Thu Nov 12, 2015 4:41 pm
by DaleFranks
In the topics linked from search results, how do I get highlighting to work? I cannot figure this out. The link has the "highlight=Xxxxx" url parameter, I have set all 11 highlight styles in the main stylesheet.

The highlighting section of the doc says "In HTML5 Top Navigation, the search hits are transparent by default" then helpfully never mentions how to change this default behavior.

I'm a little frustrated, right now.

Re: Top Navigation Search highlighting

Posted: Fri Nov 13, 2015 1:13 am
by NorthEast
All you should have to do is set styles for span.SearchHighlight1, span.SearchHighlight2.
As described here: http://webhelp.madcapsoftware.com/flare ... h_Hits.htm

Have you checked that you added these styles to the right medium in the stylesheet, e.g. they're not in print by accident?

Re: Top Navigation Search highlighting

Posted: Thu Nov 26, 2020 3:45 pm
by kerimucci
I am using the Top Nav skin to produce HTML5 output. I have added a span.SearchHighlight class to my CSS, where the font color is set to purple to make matched keywords stand out in the abstracts (as opposed to a background color). However, my output is still showing the keywords in black text. I have tried setting this both from the Stylesheet Editor and from the Internal Text Editor, and in the preview of the Stylesheet Editor, the text is purple.

Is there another setting I need to enable to get this working? I also can't get partial word searching to work, so maybe this is related.

Re: Top Navigation Search highlighting

Posted: Fri Nov 27, 2020 6:12 am
by Nita Beck
I’m pretty sure that the solution Dave pointed to is still the correct solution. You need to define the colors for span.SearchHighlightN where N is 1, 2, 3, etc. for the first search word, second search word, third search word, etc. I don’t think it’s sufficient to define span.SearchHighlight.

For Flare 2020 r2, this is covered here: https://help.madcapsoftware.com/flare20 ... h-Hits.htm

Re: Top Navigation Search highlighting

Posted: Fri Nov 27, 2020 6:48 am
by kerimucci
Thanks, I defined span.SearchHighlight, and 1-10, and am getting the same result unfortunately.

Re: Top Navigation Search highlighting

Posted: Fri Nov 27, 2020 7:59 am
by kerimucci
Ah, OK. Maybe I am looking for something else. I now see that my properties are being applied once I click a result and go to a topic page. This is good, but I was looking for something that will highlight the search term within the search results page. Right now the matched words just display bold, using the font color of the abstract. I'd like to vary just the color of the search term within the abstract on the search results page. Is this possible?

Re: Top Navigation Search highlighting

Posted: Mon Nov 30, 2020 3:53 am
by NorthEast
No, Flare doesn't support that.
Flare also just applies a bold tag on the search results page, so even if you tried some hacky CSS, you can't style the search terms separately.

Re: Top Navigation Search highlighting

Posted: Mon Nov 30, 2020 7:58 pm
by Psider
I think it might have changed, unless Madcap is doing something funky with their own help?

This search has a <span class="search-result-highlighr"> on the bolded terms.
https://help.madcapsoftware.com/flare20 ... q=variable

Re: Top Navigation Search highlighting

Posted: Tue Dec 01, 2020 1:20 am
by NorthEast
Psider wrote:I think it might have changed, unless Madcap is doing something funky with their own help?

This search has a <span class="search-result-highlighr"> on the bolded terms.
https://help.madcapsoftware.com/flare20 ... q=variable
It's different for MadCap's help because they don't use their own MadCap Search engine - they use Elasticsearch.

The same limitation applies to Elasticsearch too though; all the terms on the results page use the same span class, so you can't style them differently.

Re: Top Navigation Search highlighting

Posted: Tue Dec 01, 2020 1:28 am
by Psider
Oh right. I read it as they just wanted to change it, not that they wanted different colours.

(When they first introduced the rainbow, I have to admit I turned it off immediately :p )

Re: Top Navigation Search highlighting

Posted: Tue Dec 01, 2020 2:07 am
by kerimucci
Thanks for confirming, guys.

Re: Top Navigation Search highlighting

Posted: Wed Sep 01, 2021 9:55 am
by Corinna
Having had the same problem (with the MadCap online help being of only limited help), I might have found a not-so-hacky CSS solution.

I noticed that the only bold term on the search results page is the search term, indeed. Hence, it's possible to address that exact bold span in CSS as follows:

Code: Select all

div#searchPane._Skins_<your search results skin name>.mc-component b {background-color: <your color>;}
My example:

Code: Select all

div#searchPane._Skins_suchergebnisse.mc-component b {background-color: #0000ff;}
Since the search description (preview) text in div.description doesn't seem to carry over any formats from the original topic (at least by default), there seems to be no risk of highlighting any other bold text unintentionally.