Skip to main content.
home | support | download

Back to List Archive

Re: Using a translated link for the 'found' hyperlink,

From: Matt Paine <matt(at)not-real.mattsoftware.com>
Date: Thu Nov 24 2005 - 02:23:14 GMT
J. David Boyd wrote:

> First off, swish-e has been working perfectly for us.  Fast and
> efficient, our customers have been very happy.
> 
> Now, my bosses come along, and they don't want to show the filenames as
> the hyper link in search results, but rather a different title, gathered
> out of a table that relates filenames to titles.
> 
> I mean, for example, the filename is S2172_TABLE.pdf, but they want to
> show 'Module 72 Tables'.
> 
> Is it possible to hook into the index generation code of swish-e, and
> insert my own translation code, such that when the indexer sees
> S2171_TABLE.pdf, I can look in my translation table, and stuff the value
> 'Module 72 Tables' to be displayed in the hyperlink of the search
> result?  Of course, the hyperlink still has to point to the original file.
> 
> Did I even say that so anyone can understand it?
> 
> TIA,
> 
> Dave in Largo, FL
> 


I think I understand where your coming from. But if I'm correct in 
understanding then you dont need swish to do anything really (I think 
this is where Bill Moseley was coming from).

Basically you can setup a table structure in whatever language your 
using to display your results, and do a lookup on that table based on 
the filename..... E.g., using PHP....


<?php
	$lookup["S2172_TABLE.pdf"] = "Module 72 Tables";
	$lookup["another_filename_here.pdf"] = "Show This Title Instead";

?>

Now instead of displaying the filename in your results you can simply 
use the table instead.....

<?php
	// if there is no match in the table, use the filename instead
	$display_title = $filename;
	if (isset($lookup[$filename]))
		$display_title = $lookup[$filename];

	print $display_title;
?>

If you get my drift (none of this code is tested, but it should give you 
an idea perhaps?)


Hope it helps.


Matt
Received on Wed Nov 23 18:23:33 2005