Skip to main content.
home | support | download

Back to List Archive

Re: Filtering terms with swish.cgi

From: Dave Moreau <davidjmoreau(at)>
Date: Wed Oct 15 2003 - 07:36:47 GMT
> > > >Yes, so look at that spot I pointed out.  You would do someting like:
> > > >
> > > >   my $verses = $q->param('verses');
> > > >   if ( $verses ) {
> > > >       my $verses_key = convert_to_verses_id( $verses );
> > > >       $query .= " and verse=($verses_key)" if $verses_key;
> > > >   }
> > > >
> > I tried something like this:
> >
> > my $query = $q->param('query') || '';
> > my $verses = $q->param('verses') || '';
> > $query .= ' ' . $verses;
>Where did you add that?  If your "verses" is a separate metaname you
>will need to use that meta name like in my example above.

Verses is just from the textbox in show_form:

Terms:</td><td><input maxlength="200" value="$query" size="50" type="text" 
<tr><td>Verses:</td><td><input maxlength="200" value="$verses" size="50" 
type="text" name="verses"/></td></tr>

>There's a function called build_query().  I assume that's where you are
>placing that?  If you are placing that too early in the build_query()
>function then later it's going to get a metaname appended.

Actually, I was placing it in show_form. I just now moved the modifications 
to build_query and somewhere along the way broke the code. I have no idea 
what I did wrong, but I guess I'll work on it another day.

>If you are not using a metaname then what you are doing should work,
>although I thought you said $q->param('verses') is before it's
>converted into your verses "keyword" id.

I simplified the above example to isolate the problem. That is why it does 
not convert the verse to the encoded version. The encoded version 
(gen001001) is stored as a metaname, but i'm not limiting the search to 
metanames (see what I write below).

>I don't have enough information to really help.  But I can offer these
>1) make sure you can indeed search your verses keywords from the command
>line (without using swish.cgi).

I can do it from the command line. The encoded verses can be retrieved with 

-w gen001001


-w ref.verse=gen001001

>2) look through the build_query() subroutine and make sure you
>understand (mostly) what it's doing.  Add in "print STDERR $query"
>at various places to see what's actually getting set.

I'll try this. Unfortunately, I seemed to have broken the script when moving 
my code from show_form() to build_query(). Maybe I'll restart with the 
original swish.cgi and

thanks for the help. i'm confident that i'll be able to get it working now.


Never get a busy signal because you are always connected  with high-speed 
Internet access. Click here to comparison-shop providers.
Received on Wed Oct 15 07:36:49 2003