Skip to main content.
home | support | download

Back to List Archive

Re: MetaName searching in new API

From: Bill Moseley <moseley(at)>
Date: Mon Mar 03 2003 - 14:56:02 GMT
On Mon, 3 Mar 2003, Thomas R. Bruce wrote:

> Bill and others:
> This works fine:
> swish-e -w "casedata=3DSmith" -f /usr/local/indexes/myindex.index
> This doesn't, always returning zero hits without throwing an error =
> (error-catching is present but omitted here for clarity/brevity):
>     my $swh =3D SWISH::API -> new('/usr/local/indexes/myindex.index');
>     my $search =3D $swh->New_Search_Object()
>     my($results) =3D $search -> Execute('casedata=3DSmith');
>     my ($numhits) =3D $results -> Hits();

If you really mean "throws an error" then the module does not do that[1].

If you mean simply thta the command line version returns hits but the
SWISH::API one does not return hits, then that's odd (uses the same code
internally -- see cmd_search() in swish.c).

I'll be away this morning, but if you can send a complete test case
(sample doc, config file, command used to index, and a test perl program)
I can check it out.  The list strips attachements, so just send as the
body of a message.

> The environment is a little more complex than I'm representing here (the =
> search code is in turn part of a module).  However, the whole thing =
> works fine with non-MetaName searches, and as I mentioned command-line =
> MetaName searching works fine.  I'm a touch baffled.  Any ideas?

I'd think you would see an error like "invalid metaname" if that was the

[1] I thought about error checking and throwing the exception (die) in
SWISH::API which might make coding a bit cleaner, but I really wanted a
very thin interface to the C library.  

I haven't thought about it, but perhaps could have a parameter like:

   my $swish = SWISH::API->new(
      indexes => $index_files,
      die_on_error => $exception_object

where $exception_object could be an exception handler, or a scalar true
value which would just call "die.

Bill Moseley
Received on Mon Mar 3 14:59:12 2003