Skip to main content.
home | support | download

Back to List Archive

Re: [swish-e] modifying swish-e result title

From: Peter Karman <peter(at)not-real.peknet.com>
Date: Sat Apr 14 2007 - 00:22:28 GMT
Rasael Bervini Monkow scribbled on 4/13/07 5:33 PM:
> Thank you for the reply. :)
> 
> I am sorry but as I told you before I'm new to Perl and so I am trying to
> understand the code (I usually work with Java). what did I understand so far
> is:
> 
> 1) I have to create a property to store the H1 tag (i.e. "h1titletag"). To do
> this, I guess I need to change the $search and $result objects. Where can i
> find these objects ?
> 
> 2) Since it's possible that there will be more than one H1 tag, and I need
> only the first one, I need to use the -S prog method to store it as a
> MetaName. I didn't completely understood this part. Where do I find this
> method and how can I store it?
> 
> 3) in the show_results method I will display the correct property,
> "h1titletag", instead of the title. That sound's pretty easy after
> 

swish.cgi is not where you should begin. You can't solve your problem directly 
at search time.

You need to begin by creating an index that contains the PropertyName 
'h1titletag' in it. To do that, you need to create a config file with 
appropriate directives [1] and create/modify a document aggregator for use with 
the -S prog feature [2].

[1] http://swish-e.org/docs/swish-config.html
[2] http://swish-e.org/docs/swish-run.html#indexing_command_line_arguments

Your document aggregator can be written in any language. There are 2 examples 
supplied with Swish-e: spider.pl and DirTree.pl. Those happen to be in Perl, but 
you can write one in Java if you wanted to. The only requirement is that the 
output of the aggregator include the correct header lines as defined in [3].

[3] http://swish-e.org/docs/swish-run.html#path_name_

I was suggesting that your aggregator locate the contents of the <h1> tag you 
want to use as your title, and add a <meta> tag to the output of your aggregator 
  like:

  <meta name="h1titletag" contents="stuff from h1 here" />

which swish-e will index under the PropertyName you have specified in your 
config file.

If you are indexing with spider.pl or DirTree.pl already, then let us know and 
we can suggest places to modify them to do what you want.

If you are going to write your own aggregator, then just make sure you follow 
the headers API defined in [3].

Then once you have an index with the PropertyName data in it that you want, it's 
simply a matter of altering your template(s) to output the 'h1titletag' property 
instead of 'swishtitle'.

Hope that helps steer you.

cheers,
pek


-- 
Peter Karman  .  http://peknet.com/  .  peter(at)not-real.peknet.com
_______________________________________________
Users mailing list
Users@lists.swish-e.org
http://lists.swish-e.org/listinfo/users
Received on Fri Apr 13 20:22:28 2007