Skip to main content.
home | support | download

Back to List Archive

Re: PropertyNames in C-API?

From: Jamie Herre <jlst(at)not-real.gettysgroup.com>
Date: Wed Mar 10 2004 - 17:10:43 GMT
On Mar 9, 2004, at 7:12 PM, Bill Moseley wrote:

> On Tue, Mar 09, 2004 at 03:06:16PM -0800, JFH wrote:
>
>> Question: I'm looking for a way to get an enumeration of any
>> non-standard PropertyNames stored in an index.
>
> Actually, this has come up a few times before.  I actually spent some
> time trying to implement the feature but ran into a a few 
> complications.
> It shouldn't be that hard -- dump.c can display them, after all.
>
> I'm guess you are trying to write something to detect what fields are 
> in
> the index and provide a general interface to any index.

Yep.  Sorry if I was unclear.

>
> I've always found that I needed to know more than just the name -- I
> needed to know their type (which is in the index) but also what they
> mean in a human context.  If there's a property name "foo" how do you
> display it without knowing if it's a long description or a date or a
> number or a URL or whatever?

Of course you are correct, but it would also be useful to have a quick 
and dirty
way of accessing any index.  Something along the lines of running a 
search
and getting back an array of hashes containing all known properties.

>
>> I've been mucking about by following the example of dump_metanames() 
>> in
>> dump.c but I don't think that's the right way to go about this.
>
> Well that will give you an idea how to get the names listed.  The 
> harder
> part is deciding on the API -- should you pass in an index name and get
> a list of property names as strings back?  And how about the meta data
> associated with a metaname or propertyname?  In Perl it might be nice 
> to
> get an array of objects with methods to fetch the name, id, type and
> other meta data.  Or perhaps a hash or hashes.

I guess I was thinking exactly that.  Get a list of property names from 
the index and provide a function to get the type from the name.  Since 
SwishResultPropertyStr() works regardless of type, a user has the 
option of skipping that step which might be appropriate for loosely 
typed languages such as perl.

What metadata is associated with a propery besides its name, type and 
id?  I don't think the ID is relevant to the C-API as there's not much 
you can do with it.

So I guess:

const char **SwishPropertyNames( SW_HANDLE );
PropType SwishPropertyType( SW_HANDLE, const char *index_name );

I'm also guessing that SwishPropteryNames() should return all property 
names in the index and we'd follow the convention that those beginning 
with "swish" are standard and those which do not were set via 
PropertyNames directives.

Anyway, I'd like to do it in a way that I could contribute back so let 
me know if I'm on the right track or not.
Received on Wed Mar 10 09:10:45 2004