Skip to main content.
home | support | download

Back to List Archive

Re: How to install Perl Packages? - solved + 2

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Fri Jun 07 2002 - 15:00:58 GMT
At 07:09 AM 06/07/02 -0700, Jody Cleveland wrote:
>I would like to edit the layout of both the search page, and the results
>page so that they match the layout of my site. I've searched everywhere, and
>can't figure out how to do that. 

Yes, it's not very clear.  36 lines into the docs it says:

       The script is modular in design.  Both the highlighting
       code and output generation is handled by modules, which
       are included in the example/modules directory.  This
       allows for easy customization of the output without
       changing the main CGI script.  A module exists to generate
       standard HTML output.  There's also modules and template
       examples to use with the popular Perl templating systems
       HTML::Template and Template-Toolkit.  This allows you to
       tightly integrate this script with the look of an existing
       template-driven web site.  HTML::Template and Template-
       Toolkit are available from the CPAN
       (http://search.cpan.org).

But it doesn't really say what you need to do.

A little farther down in the docs there's this section:

Frequently Asked Questions
       Here's some common questions and answers.

       How do I change the way the output looks?

See if that section doesn't help.  There's also the section:

       How do I use a templating system with swish.cgi?

which might be of interest if you are building an entire template-driven site.


>Also, I use css for layout on my site. The only part of the pages I want
>searched is a certain div tag, which is the body of the page. I noticed
>somewhere in the documentation where it mentioned placing comment tags at
>the start and end of the area you want to be searched. For the life of me, I
>can't seem to find this information anywhere in the documentation today.

I have that problem, too.  The older I get the more I use grep.

You say you only want the body searched?  Not the <title> text?  Most
people do want to search the title, but you may have your reasons.

There's a few options.  First, you can use the -t flag to limit searches to
parts of the HTML doc (see SWISH-RUN man page).  The swish.cgi script
doesn't support that feature, but it would be a one line hack if you wanted
to limit to body in all searches.

Another option is to specify body as a metaname (MetaNames body) in the
config, but you need libxml2 support to do that.

~/swish-e/src > cat c
MetaNames body
IndexContents HTML2 .html

~/swish-e/src > cat 1.html
<html>
  <head>
     <title>Title</title>
  </head>

  <body>
    Bodyword
  </body>
</html>

~/swish-e/src > ./swish-e -c c -i 1.html -T indexed_words -v0
  Adding:[1:swishdefault(1)]   'title'   Pos:2  Stuct:0x7 ( HEAD TITLE FILE )
  Adding:[1:body(10)]   'bodyword'   Pos:5  Stuct:0x89 ( META BODY FILE )


~/swish-e/src > ./swish-e -w body=bodyword -H1
# SWISH format: 2.1-dev-25
# Search words: body=bodyword
# Number of hits: 1
# Search time: 0.000 seconds
# Run time: 0.038 seconds
1000 1.html "Title" 68
.

~/swish-e/src > ./swish-e -w body=title -H1   
# SWISH format: 2.1-dev-25
# Search words: body=title
err: no results
.

>Oh,
>and when I get search results, there is a (NULL) underneath the title of
>each result. If I set those comment tags, will I then see a description
>under those titles?

In the FAQ section of the swish.cgi docs:

   Why does the output show (NULL)?

>Thank you both again, for all of your excellent help.

No problem.  Glad things are working for you.


-- 
Bill Moseley
mailto:moseley@hank.org
Received on Fri Jun 7 15:04:41 2002