Welcome! Log In Create A New Profile

Advanced

highlight search results

Posted by BC Editor 
highlight search results
January 20, 2016 07:58AM
Hello,
is there a possibility to have the results page show the search results "highlighted" (such as given a "yellow background"winking smiley when going to page shown in the search results list ?
rap
Re: highlight search results
January 20, 2016 05:41PM
Sphider only finds pages with a given content. To highlight the search term on a returned page means to edit that page. Sphider does not edit pages. It only scans them.

Short answer: No.
Tec
Re: highlight search results
January 20, 2016 06:33PM
@ rap:

Sorry but your answer is not quite correct.
In script …/include/searchfuncs.php find
			foreach($words['hilight'] as $change) {
				while (preg_match("/[^\>](".$change." )[^\<]/i", " ".$title." ", $regs)) {
					$title = preg_replace("/".$regs[1]."/i", "<b>".$regs[1]."</b>", $title);
				}

				while (preg_match("/[^\>](".$change." )[^\<]/i", " ".$fulltxt." ", $regs)) {
					$fulltxt = preg_replace("/".$regs[1]."/i", "<b>".$regs[1]."</b>", $fulltxt);
				}
				$url2 = $url;
				while (preg_match("/[^\>](".$change." )[^\<]/i", $url2, $regs)) {
					$url2 = preg_replace("/".$regs[1]."/i", "<b>".$regs[1]."</b>", $url2);
				}
			}

Here all keywords found in database will get marked as 'bold' by the <b> . . .</b> tags.

The 'bold' tags need to be replaced by a css class highlighting the background between the tags.

Example desired?
http://www.search.sphider-plus.eu/search.php?query_t=sphider&search=1

Tec
rap
Re: highlight search results
January 20, 2016 11:03PM
The code ONLY highlights the search terms on the results page. The question, as I read it, is to highlight the search term on the indexed page. Sphider is incapable of doing that.
Tec
Re: highlight search results
January 21, 2016 07:51AM
Well, 'BC Editor' asked:
<<< . . to have the results page show the search results "highlighted" >>>
Please recognize '. . . the result page show . . '.

Tec
rap
Re: highlight search results
January 21, 2016 04:05PM
And the REST of the question was "(such as given a "yellow background" when going to page shown in the search results list ?"

Sphider can not do that to the indexed page.

Don't mean to get into a shouting match here. Both your answer and mine are correct for each of our interpretations of what is not a perfectly clear question.
Tec
Re: highlight search results
January 21, 2016 04:45PM
Yes, let us wait for the reply of 'BC Editor', explaining his real demand.
But I agree, Sphider will not be able to highlight the original URL, cited in result listing.

Tec
Sorry, only registered users may post in this forum.

Click here to login