[Solved] Highlight missing from search results?

If you're having questions about some aspect of Nucleus, use this forum.
User avatar
dis
Posts: 209
Joined: Mon Aug 19, 2002 3:56 am

[Solved] Highlight missing from search results?

Postby dis » Tue Feb 23, 2016 5:30 am

Hi,

Just noticed that the highlight is missing from my search results. This is on a very new downloaded clean install of the Japanese github Nucleus v3.70. In the old Nucleus versions, I remember I could define a highlight color and background color in my stylesheet and the keywords would be highlighted with that color scheme in my search results.

I checked my stylesheet and it does have ".highlight" defined. The search result displays the full posts containing the search keyword, but the keyword is not highlighted like the old versions of Nucleus used to do it.

I looked in globalfunctions.php and saw that the highlight function is still there. I also saw highlighting mentioned in blog.php and baseactions.php. I did not see the highlight function being called in search.php but I don't know much about coding so I'm not sure if that's relevant. (If you look at the source for the result, the keywords no longer have a stylesheet tag attached to them, so of course the style does not get applied to them.)

If it doesn't work this way in the new 3.70 version, or if I am doing something wrong, please let me know! If it is broken, then I would be grateful if anyone could fix this. Highlighting is quite useful for a search. Otherwise you end up searching twice - once with the nucleus search function, and then again with your browser's in-page find function just to see find the keywords on the page! :)

Thanks very much in advance for any help you can give!
Last edited by dis on Tue Feb 23, 2016 9:26 pm, edited 1 time in total.
User avatar
yama
Posts: 122
Joined: Tue Dec 05, 2006 2:23 pm
Contact:

Highlight missing from search results?

Postby yama » Tue Feb 23, 2016 2:13 pm

Would you try this file? Over write into nucleus/libs/
Attachments
SEARCH.zip
(2.18 KiB) Downloaded 138 times
User avatar
dis
Posts: 209
Joined: Mon Aug 19, 2002 3:56 am

Highlight missing from search results?

Postby dis » Tue Feb 23, 2016 8:30 pm

HI Yama,

Thanks for the quick reply! I just replaced the file and tried searching again. There is still no highlight. I am trying to look at some of my old copies of Nucleus to see what is different. Maybe there is something I am doing wrong.

[Edit: I just found another installation, an older copy but also 3.70, and highlighting works there! I'm trying to spot the difference now :)]
User avatar
dis
Posts: 209
Joined: Mon Aug 19, 2002 3:56 am

Highlight missing from search results?

Postby dis » Tue Feb 23, 2016 8:35 pm

Update 1: it may not be search.php. The search.php in the copy that is working seems to be the same as the one in the copy that is not working. It has the same timestamp and filesize.

Update 2: comparing all the files in the lib folder, all the file sizes and timestamps are the same. So either I am doing something wrong in my new install, or the difference is in a different folder...
User avatar
dis
Posts: 209
Joined: Mon Aug 19, 2002 3:56 am

Highlight missing from search results?

Postby dis » Tue Feb 23, 2016 8:44 pm

Mystery solved! The search highlight code was missing from my template! I don't know how/why it was missing - I imported some previous templates and only modified them slightly, so this should still have been there, but somehow the two fields under the Search section of the template were both empty. I have now put back the original code and search highlights are working again! Yay!!! :mrgreen:

If anyone else has this problem in future, this is the code that should be in the template:

Under the Search section in your template, the Highlight field should have something like this:

Code: Select all

<span class="highlight">\0</span>


and the "nothing found in search" field should have something like this:

Code: Select all

No search results found for <b><%query%></b>


Thank you very much for your help Yama. Sorry I took up your time with this! I will remember to check those fields first next time :oops: :D

Return to “General Questions”