Skip to main content.
home | support | download

Back to List Archive

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

From: J. David Boyd <david(at)not-real.adboyd.com>
Date: Mon Nov 28 2005 - 16:42:24 GMT
J. David Boyd wrote:
> Matt Paine wrote:
> 
>>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
>>
> 
> 
> Thanks for the info.  My mileage will definitely vary, as I'm using the
> as provided swish.cgi, with a few small configuration file changes.
> 
> I'm going to attempt to set the actual title into every PDF file using
> pdftk, as Bill Moseley says that swish-e will auto-magically index the
> title if it exists.
> 
> I'll know soon enough, and if it doesn't work for me, I'll be coming
> back here for help!
> 
> Right now I'm working on a Perl function to lookup names from out of an
> Excel spreadsheet, and use those to generate the html names on our web
> pages, and to rename the pdf files.  Wish me luck!
> 
> Dave in Largo, FL
> 
> 

Okay, something is wrong.  I've added in titles to a few PDF files,
I can see the titles if I right-click in windows, and use the PDF tab,
or open the file in Adobe Reader, and look at the document properties.

I used pdftk to set the meta properties for title and author, and it all
seems okay to me, looking at it manually.

However, swish-e is still showing me the actual file name rather than
the title in the link in the search results.

Bill said that using the title was the default behavior.  Is there
someplace else perhaps that I need to toggle a bit?

Dave
Received on Mon Nov 28 08:42:29 2005