Skip to main content.
home | support | download

Back to List Archive

Re: Retrieving a list of valid properties

From: Bill Moseley <moseley(at)>
Date: Wed Feb 05 2003 - 16:01:24 GMT
On Wed, 5 Feb 2003, Thomas R. Bruce wrote:

> Folks:
> Has anyone got a way, using the SWISHE perl interface,  to retrieve a list
> of valid properties from an index?    Obviously it can be done from the
> command line via  swishe -T INDEX_METANAMES -f whatever.index , augmented by
> some grepping and cutting, but I don't see a way to do it from within perl.
> Obviously there's a not-unreasonable assumption here that if you're running
> a site you oughta know what properties you indexed the thing with, or at a
> minimum be able to find the config file that memorializes those decisions.
> But it would be nice to be able to do sanity-checking on properties before
> submitting them in a query, particularly in environments (like the Mason
> templating system) where the "bad property" error will not be reported and
> the app will sink without a trace.

That info is not stored in a config file, rather in the index.   Since
the list of properties and metanames is static for an index I didn't see
any advantage of a library interface over piping swish-e -T
index_metanames since you only need to do that once in a persistent
environment.  If not running persistent then use Storable to cache the

A property might be a date, or a value, or a long description -- so
I'd expect that the application would need to know not just what props are
in an index, but what they mean, so they can be displayed in a reasonable
way, perhaps with better human-readable names.  In the swish.cgi script
you list both the property names, and a hash to map those to a better
description of that property (e.g. mdate => 'Last Modified Date' ).

I guess I don't understand what you mean "sink without a trace" because if
you ask to display an invalid property:

    my $prop = $result->property( 'foo' );

$prop will be undefined if "foo" doesn't exist.

Oh, that's the new API way at reading a property.  If you are just
starting out with SWISHE module and perl, I'd stronly recommend using the
dev version of swish-e as the API for the library has changed.  See:

There's a pure perl module that provides an interface to the new
SWISH::API module, but the interface for SWISH::API module it much nicer
to work with under perl.

Bill Moseley
Received on Wed Feb 5 16:01:52 2003