Skip to main content.
home | support | download

Back to List Archive

Re: ReplaceRules Stacking

From: Peter Karman <peter(at)not-real.peknet.com>
Date: Fri Oct 28 2005 - 13:24:08 GMT
> I would like to know if it's possible to stack "ReplaceRules replace"
> lines in the swish config file. I can't seem to get it to work. Only the
> first rule seems have an effect.
>
> What I'm looking for is something like this:
> ReplaceRules replace %2f /
> ReplaceRules replace %23 #
> ReplaceRules replace %60 '
> ReplaceRules replace %60 '
> ReplaceRules replace %5E ^
> ReplaceRules replace %2f /
>


I just tried a test like this:

karpet@cartermac 22% swish-e -c c -i foo%23%5E.html  -T properties
Indexing Data Source: "File-System"
Indexing "foo%23%5E.html"
          swishdocpath: 6 ( 10) S: "foo#^.html"
          swishdocsize: 8 (  4) N: "97"
     swishlastmodified: 9 (  4) D: "2005-06-09 07:20:24 CDT"
Removing very common words...
no words removed.
Writing main index...
Sorting words ...
Sorting 10 words alphabetically
Writing header ...
Writing index entries ...
  Writing word text: Complete
  Writing word hash: Complete
  Writing word data: Complete
10 unique words indexed.
4 properties sorted.
1 file indexed.  97 total bytes.  12 total words.
Elapsed time: 00:00:00 CPU time: 00:00:00
Indexing done!
karpet@cartermac 23% cat c
ReplaceRules replace %2f /
ReplaceRules replace %23 #
ReplaceRules replace %60 '
ReplaceRules replace %60 '
ReplaceRules replace %5E ^
ReplaceRules replace %2f /


Which suggests to me that, in fact, swish-e supports a list of rules.
Unless I'm oversimplifying your question?


>
> This seems to be the only real solution because the regex feature would
> require many rules in order to catch all the possible file names.

You might find that this is easier to fix if you use the DirTree.pl/-S
prog combo method instead of the default -S fs method. Then you'd have
full command of the Perl regexps and you could manipulate the URL values
any way you wanted without relying on the built-in regexp of Swish-e
(which is fairly vanilla).

To go one step further, you might even consider foregoing the intermediate
step of HTML files, and pipe your MySQL output directly to swish-e with -S
prog. And consider doing it as XML instead of HTML (though the wisdom of
that depends on your particular application).


-- 
Peter Karman . http://peknet.com/ . peter(at)not-real.peknet.com
Received on Fri Oct 28 06:24:14 2005