1 (edited by ssb 2005-03-23 16:02)

Topic: Search Results Highlighting MOD

##
##        Mod title:  Admin CP Localization
##
##      Mod version:      1.0.3
##   Works on PunBB:      1.2.4
##    Based on latest     1.2.4 SVN (153)
##     Release date:      2005-03-23
##           Author:      Sakis (aka SSB) (ssb@in.gr)
##
##      Description:      Searching keywords highlighting mod
##
##   Affected files:      search.php
##                        vewtopic.php
##                        your stylesheet
##
##       Affects DB:      No
##
##            Notes:      Coded with minimum changes to the original PunBB-files.
##                        It highlights all found keywords after a successful searching.
##                        Mod recognizes wildcard and highlights the whole maching words.
##                        It works fine with quoted text and code.
##
##       DISCLAIMER:      Please note that "mods" are not officially supported by
##                        PunBB. Installation of this modification is done at your
##                        own risk. Backup your forum database and any and all
##                        applicable files before proceeding.
##
##
##    Installation: Follow next steps to enable admin CP localization.
##
##    Replace PunBB search.php, viewtopic.php files with those in mod archive
##    Append the following line in \imports\Oxygen_cs.css or your own color scheme stylesheet
##
##    SPAN.hlight {font-weight: bold; COLOR: #FF0000}
##
##    That's all...
##
##    If you want to apply this mod manually, there are two diff files included in archive.
##

This mod highlights all found keywords after a successful searching.
It recognizes wildcard (*), highlighting the whole maching words and works in quoted / code text too.

Highlighting color depends on a CSS entry, you can append in your own color scheme stylesheet.
For example, the next entry appended to style/imports/Oxygen_cs.css diplays keywords bold-red
SPAN.hlight {font-weight: bold; COLOR: #FF0000}

Thia mod has been tested with English amd foreign iso-8859-xx encodings and seems to work just fine.
It was not test extensively with UTF-8 though. If you find any bugs, please post me a note.

Download it!

This mod works with latest PunBB (1.2.4) but it can be easily adapted to any previous and/or future version.
BTW i'd like to see this mod or any other similar, included in PunBB official code. IMHO searching results highlighting, is a must.

Regards

Sakis is my name, ssb just a nick.

Re: Search Results Highlighting MOD

thats usefull for big forums (such as this)

nice work wink

3 (edited by adsh 2005-03-22 03:32)

Re: Search Results Highlighting MOD

This mod not working with non English words (Russian).

Locale is windows-1251.

And  highlighting not working on NOT first search results pages.

When user submit http://site/search.php?action=show_new there are many errors on the page:

Notice: Undefined variable: hl in /path/to/site/search.php on line 619

4 (edited by ssb 2005-03-22 09:58)

Re: Search Results Highlighting MOD

adsh wrote:

And  highlighting not working on NOT first search results pages.

Sorry but could you please explain what you mean ?

When user submit http://site/search.php?action=show_new there are many errors on the page

Hmm, i cannot see that behavior in my own intranet forum. Please tell me, did you install this mod manually or using included files ?

$subject = '<a href="viewtopic.php?id='.$search_set[$i]['tid'].(($hl != '') ? '&hl='.$hl : '').'">'.pun_htmlspecialchars($search_set[$i]['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($search_set[$i]['poster']).'</span>';

As you can see in line 619 there is only a simple IF structure that checks if $hl var exists and is assigned, before using it. Even if this comparison fail, there is no reason for such an error.

Please double check mod installation and post here your findings. Also, are you using any other mods affecting search.php and viewtopic.php ?
According to encoding, unfortunately i cannot do any testing in Russian. All iso-8859-xx and many ANSI encodings i've tried like cp-1252, cp-1253, cp-1255, work fine here.

If any other mod user has any similar problems, please post here a note.

Sakis is my name, ssb just a nick.

5 (edited by adsh 2005-03-22 15:57)

Re: Search Results Highlighting MOD

ssb wrote:

Sorry but could you please explain what you mean ?

For example search results contain many pages.

Link to 1-st page:

http://adsh.ukrweb.net/radiohobby/viewtopic.php?id=621&hl=adsh

Link to 2-nd page:

http://adsh.ukrweb.net/radiohobby/viewt … 21&p=2

...

Link to 11 page:

http://adsh.ukrweb.net/radiohobby/viewt … 1&p=11

There are no &hl=adsh at non 1-st pages.

ssb wrote:

Hmm, i cannot see that behavior in my own intranet forum. Please tell me, did you install this mod manually or using included files ?

I install included files viewtopic.php and search.php.

Error in http://adsh.ukrweb.net/radiohobby/searc … n=show_new take place if search results not emply only.

You can register and test any in this topic:

http://adsh.ukrweb.net/radiohobby/viewtopic.php?id=49

ssb wrote:

Also, are you using any other mods affecting search.php and viewtopic.php ?

There are NO any other mods / hacks on this forum.

6 (edited by ssb 2005-03-22 17:28)

Re: Search Results Highlighting MOD

Oops sorry you're right adsh, it's a nasty bug neutral
Re-download mod from same url and replace your current search.php, viewtopic.php files with those included in the archive.

Try it and post me a note...

Sakis is my name, ssb just a nick.

7 (edited by adsh 2005-03-22 20:23)

Re: Search Results Highlighting MOD

Multipage non highlighting bug fixed.

But I click http://adsh.ukrweb.net/radiohobby/searc … n=show_new - 1 new topic found and there are 4 errors on page:

Notice: Undefined variable: hl in /usr/local/httpd/www/adsh.ukrweb.net/radiohobby/search.php on line 619

Notice: Undefined variable: hl in /usr/local/httpd/www/adsh.ukrweb.net/radiohobby/search.php on line 633

Notice: Undefined variable: hl in /usr/local/httpd/www/adsh.ukrweb.net/radiohobby/search.php on line 641
   
Notice: Undefined variable: hl in /usr/local/httpd/www/adsh.ukrweb.net/radiohobby/search.php on line 664

Russian words search in any case not working:

http://adsh.ukrweb.net/radiohobby/viewt … F0&p=1

Search word is "http://adsh.ukrweb.net/radio/forum/programming/transistor.gif" ("transistor" on English) - there is no highlighting.

It is 2-nd word in this message on the page.

I think this is because search word is urlencoded. There are no urlencoding of English search words - in that case search work fine.

8 (edited by ssb 2005-03-23 09:19)

Re: Search Results Highlighting MOD

I think i know what cause those errors. I'm currently working on this and Russian encoding.
In the meantime, please re-download updated mod and try it for errors.

Regards

Sakis is my name, ssb just a nick.

9

Re: Search Results Highlighting MOD

ssb wrote:

I think i know what cause those errors. I'm currently working on this and Russian encoding.
In the meantime, please re-download updated mod and try it for errors.

"Notice: Undefined variable" bug in search.php fixed.

Russian words search highlighting not working.

10

Re: Search Results Highlighting MOD

adsh,
I've uploaded an updated mod, please try that too.

BTW i installed punbb + highlight mod using windows-1251 encoding, and tried some russian posts. In fact i've copied and paste messages from your own forum.
Well, it works here, highlighting Russian keywords hmm

What's you apache/php versions ?

Sakis is my name, ssb just a nick.

11 (edited by adsh 2005-03-23 23:25)

Re: Search Results Highlighting MOD

ssb wrote:

I've uploaded an updated mod, please try that too.

BTW i installed punbb + highlight mod using windows-1251 encoding, and tried some russian posts. In fact i've copied and paste messages from your own forum.
Well, it works here, highlighting Russian keywords hmm

What's you apache/php versions ?

Now search for Russian words not working in general (no search results for any russian words) smile.

Are you sure that russian words stored in your DB and HTML output is NOT in HTML codes as on this topic?

Apache 2.0.53, PHP 4.3.10, MySQL 4.0.24 with default charset "cp1251", all datas in DB stored in windows-1251, FreeBSD 4.10.

12 (edited by ssb 2005-03-24 14:19)

Re: Search Results Highlighting MOD

Hmm tt works here, i'm a bit confused hmm
Give me some time to test it.

Sakis is my name, ssb just a nick.

13 (edited by tuyau45 2005-03-27 00:35)

Re: Search Results Highlighting MOD

Excellent !

I was planing to wonder something like that in the features request forum and you do it !!!

To get a "google" style I used the following

SPAN.hlight {background-color: #FFFF00}

Do you plan (when the russians characters will be debuged) to Highligh the topics both in viewtopic.php and search.php ?

Thanks a  lot

14

Re: Search Results Highlighting MOD

Do you plan (when the russians characters will be debuged) to Highligh the topics both in viewtopic.php and search.php ?

If you mean highlighting keywords in search.php when topics are shown as post excerpts, i don't think it's such useful.
These posts is only a filtered part of original messages and many times don't contain searched keywords. But i will consider such an implementation after encoding issues have been fixed.

Regards

Sakis is my name, ssb just a nick.

Re: Search Results Highlighting MOD

I mean ...

http://georezo.net/punbb/highlighting_1.jpg
http://georezo.net/punbb/highlighting_2.jpg

Done with Firefox

Re: Search Results Highlighting MOD

By the way a small "bug" or probably something forgetted ...

If you do a search with option Show results = Post the searched word is not Highlighted

good luck

17

Re: Search Results Highlighting MOD

Later this week i'll upload a new mod version. I hope most issues will be addressed smile

Sakis is my name, ssb just a nick.

18

Re: Search Results Highlighting MOD

I try utf-8 for search, but not work for me, thanks.

Re: Search Results Highlighting MOD

Will you make a normal readme install file?  My host doesn't allow SSH, and I have modified viewtopic and search files.

Re: Search Results Highlighting MOD

ssb any news ?

Re: Search Results Highlighting MOD

this mod might be better using javascript to do the actual highlighting, this script is nice and can be adapted ( http://scott.yang.id.au/2004/06/se-hilite/ ) means you don't have to do alot of the proccessing server-side if you just changed this mod to pass a list of search words to the javascript it can search the page for the words and highlight appropriatly wink

not sure how much better it is but i would have thought it alot better for high load servers

22

Re: Search Results Highlighting MOD

tuyau45,
t'm working on it, please give me a few days to test it.

Sakis is my name, ssb just a nick.

23

Re: Search Results Highlighting MOD

Russian search problem fixed. Solution:

http://punbb.org/forums/viewtopic.php?pid=40828#p40828

Re: Search Results Highlighting MOD

The link in post 1 is broken, would be nice to have this.