Skip to main content.
home | support | download

Back to List Archive

Re: [SWISH-E:371] ReplaceRules problem

From: Marjolein Katsma <webmaster(at)>
Date: Thu Jul 16 1998 - 08:02:40 GMT

At 20:41 1998-07-15 -0700, Richard Schlief wrote:
>    I wish to have a ReplaceRules function do a replacement AFTER the
>index.  For example, I have some text files that are normally displayed
>via a cgi script, but I want them to be indexed by swish AND have the
>link replace the path with the '...cgi-bin/' so it would
>display the text file properly.
>    If I do a ReplaceRules replace on the path, it gets the link
>information right (using the cgi replacement info), but it only shows
>the file name and size in the result page, no comments.
>    So, what do I do?

Do you mean your search results have a correct link but the link
description is the file name only? Firts of all, ReplaceRules always works
on the URL only - never the link description (either the file name or the
file's TITLE information).

I can see two possible solutions (I have to guess a little since you don't
give an exact description but I think one of these will cover it):

1) The text files do indeed contain a title and you would like to have that
displayed instead of the file's name; in that case you'll have to make sure
the file type is recognized by the program as "HTML" files. Currently
that's hard-coded in the program as either .htm(l) or .sht(ml). You could
rename the files with one of these extensions, index, and use aother
ReplaceRules line to have the link indicate the correct file name; then
rename the files back to their original names before a search will happen.
(That's a lot of work --and you'd have to do it each time you index those
files--, and it's part of the reason why I think that what is considered as
"HTML" files should really be a configuration option in the run-time
configuration file - there are a lot more extensions nowadays than shoul;d
be treated as "HTML" so it should be easily configurable).

2) The text files are just plain text and don't contain a <TITLE> tag. In
that case the indexing function will use the plain file name (without a
path) as its title and this is what will be shown as the link description
in a search result: ReplaceRules works only on the file path (that's
sensible: so it doesn't mess up any *real* file titles!). If you wnat to
show the full file path as a link description instead, what you should do
is add a little extra parsing to the interface (the AutoSwish Perl program
or whatever you use in its place) so that the file title (whihc is the file
name) is replaced by the full path name (the URL of the link). That's also
a lot of work ;-) - but at least you'd have to do it only once.

Hope this helps!


Marjolein Katsma
Java Woman -
Received on Thu Jul 16 01:12:21 1998