"search highlight plugin" ...gone?

Creating and modifying plugins.
Post Reply
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

"search highlight plugin" ...gone?

Post by sph »

hi folks!

umm, i added a search-function to my blog and now i want to highlight the search keywords - maybe with customized colors.

i found some discussion here about a "search highlight plugin" which maybe would be what i want - but i can't find this or something similar at the plugins-list o_0

so, is there something similar? or do i have to get this plugin elswhere?

any help welcome ( ;) ),

cheers&beers!



edit: aaah, not to be missunderstood: i don't want to highlight the search-text entered at google or those websearches.

i do want to highlight the search text entered at my blog-search. is this possible?
the island of stupid - come to where the monkey is...
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post by carl_galloway »

great concept it would be awesome if that could be added. I've asked in the past if we could change the search results so that instead of seeing the entry body we actually see a snippet of the entry around where the search term appears. Garvin mentioned that this would take a lot of system resources on the server and might not be a good idea, but your idea could work. We already place a <span> around the search term in the serendipity message that says how many searcfh results there are, so it might not be too difficult to do the same thing inside the entry. Maybe one of the developers could let us know how easy this would be.

If they can make it work, then we would just need to add some css styling to the search term so that it appears highlighted.
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

Post by sph »

so - this means there is no such function right now, right?

damn, i thought so :)


meanwhile i found this "search highlight plugin" - of course this plugin is still where it sould be. but it's not working for my purposes.

but maybe someone able to code stuff could use this highlight-plugin and check out how it works? and then use this function as a seperate plugin for the blog-intern search terms?

don't know how hard this is. just would be nice, i guess :)

i love your idea of having a span (maybe span&id, class or sth...) around the search terms. would be exactly what i thought about! :)

your mentioned snipped-function would be nice, also - but this sounds really a little more complicated. i guess a simple highlight would be easier. at least i hope so ;)


---
edit: this forum is... strange. should i contact my isp or is really something wrong here? loading-times are horrible...
the island of stupid - come to where the monkey is...
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

My computer must have rebooted while I wrote my reply. I think this can be implemented with a change to serendipity_printEntries(). I'd just check if $serendipity['action'] == 'search', then explode($serendpity['GET']['searchterms'] on space, and do a str_replace() for each term to surround it with a span. I'd make the spans have two classes: foundterm and foundtermN, where N is the number of the term. That way we can highlight the first term in yellow, the second in blue, etc -- but still have a catch-all if the style doesn't cover all the search terms.

I just don't know when I'll get to it.
Judebert
---
Website | Wishlist | PayPal
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

Post by sph »

judebert wrote:My computer must have rebooted while I wrote my reply.
so, in memory of the origin posting - r.i.p. ;)
judebert wrote: I think this can be implemented with a change to serendipity_printEntries(). I'd just check if $serendipity['action'] == 'search', then explode($serendpity['GET']['searchterms'] on space, and do a str_replace()...
whatever you're talking about - does this mean it is possible without bigger problems? wel, we'll see :)
the island of stupid - come to where the monkey is...
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Yes, it should be something I can implement without too much trouble. It's just a matter of finding the time...
Judebert
---
Website | Wishlist | PayPal
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Okay, I think I've got it. I just put it in SVN on berlios.de. Give it a try and warn me if I messed anything up.
Judebert
---
Website | Wishlist | PayPal
Post Reply