On Fri, Mar 10, 2006 at 01:03:04PM -0800, J Medrick Stevenson wrote:
> 1. I would like to change the wording when there are no results from "no
> results" to "No Results Were Found." I am able to successfully change
> other errstr messages, such as "Please enter a query string," but I
> can't get a change to the no results message to show up. Is this pulled
> from some other file?
> I tried to change the following code, with no success:
>
> # Add in results-related headers
> $headers->{'parsed words'} = join ' ', $results->ParsedWords(
> ($swish->IndexNames)[0] );
>
> if ( ! $results->Hits ) {
> $self->errstr('no results');
> return;
> }
> $headers->{'number of hits'} = $results->Hits;
"no results" is also reported directly by swish:
$ swish-e -w dkdkd
# SWISH format: 2.5.4
# Search words: dkdkd
# Removed stopwords:
err: no results
.
So, maybe it's in the code right above?
if ( $swish->Error ) {
$self->errstr( join ': ', $swish->ErrorString, $swish->LastErrorMsg );
delete $cached_handles{$indexes} if $swish->CriticalError;
return;
}
> 2. Is there anyway to remove the Reverse Sort checkbox option from the
> search form?
Edit TemplateDefault?
return join "\n",
'Sort by:',
$q->popup_menu(
-name =>'sort',
-values => $sort_metas,
-default=>$sort_metas->[0],
-labels =>$name_labels
),
$q->checkbox(
-name => 'reverse',
-label => 'Reverse Sort'
);
}
>
> 3. Also, I am using TemplateDefault.pm to format my results. I would
> like to rename that file something like TemplateMYSITE.pm and have the
> swish.cgi find it, but I'm not sure what in the swish.cgi file to change.
>From perldoc swish.cgi:
=head2 How do I change the way the output looks?
The script uses a module to generate output. By default it uses the
SWISH::TemplateDefault.pm module. The module used is selected in the
swish.cgi configuration file. Modules are located in the
example/modules/SWISH directory in the distribution, but are installed in
the $prefix/lib/swish-e/perl/SWISH/ directory.
To make simple changes you can edit the installed SWISH::TemplatDefault
module directly, otherwise make a copy of the module and modify its package
name. For example, change directories to the location of the installed
module and copy the module to a new name:
$ cp TemplateDefault.pm MyTemplateDefault.pm
Then at the top of the module adjust the "package" line to:
package SWISH::MyTemplateDefault;
To use this modules you need to adjust the configuration settings (either at
the top of F<swish.cgi> or in a configuration file:
template => {
package => 'SWISH::MyTemplateDefault',
},
The module does not need to be in the SWISH namespace, and can be stored in
any location as long as the module can be found via the @INC array (i.e.
modify the "use lib" statement in swish.cgi if needed).
--
Bill Moseley
moseley@hank.org
Unsubscribe from or help with the swish-e list:
http://swish-e.org/Discussion/
Help with Swish-e:
http://swish-e.org/current/docs
swish-e@sunsite.berkeley.edu
Received on Fri Mar 10 15:51:08 2006