Skip to main content.
home | support | download

Back to List Archive

Re: FW: Trouble with Swish-e C API

From: Bill Moseley <moseley(at)>
Date: Wed Apr 28 2004 - 20:15:22 GMT
On Wed, Apr 28, 2004 at 09:38:55AM -0700, Windmueller, David wrote:
> > Currently, I'm trying to use the Swish-e API to perform simple
> > queries.  Using the SwishResultPropertyULong function, I've noticed
> > that all of the basic numerical data property values return
> > ULONG_MAX as if the value doesn't exist.  This is for properties
> > like "swishrank", "swishsize" etc.  (I'm using swish 2.4.2.) 

That sucks.

Index: docprop.c
RCS file: /cvsroot/swishe/swish-e/src/docprop.c,v
retrieving revision 1.118
diff -u -r1.118 docprop.c
--- docprop.c   9 Mar 2004 20:13:24 -0000       1.118
+++ docprop.c   28 Apr 2004 20:01:19 -0000
@@ -428,6 +428,8 @@
                     "Property '%s' is not numeric", pname );
         value = ULONG_MAX;
+    else 
+        value = pv->value.v_ulong;
     freeResultPropValue( pv );

Anyone want to help write a test suite?

> > I've had some confusion with the usage of SW_RESULT and RESULT.
> > 
> > The online doc list the getResultPropValue parameters as (RESULT *,
> > char * pname, int id).  This should be (SW_RESULT, char * , int)

Where? has:

    PropValue *getResultPropValue (SW_RESULT r, char *propertyname, int ID );

> > Should the system set an error if you search for a property value
> > that is not available?  This error would be found by SwishError().

That's been a big debate on the Perl side (i.e. should an invalid
property call die() or not).

For SwishResutPropertyULong() the docs say:

    On error returns UMAX_LONG. This is commonly defined in limits.h. Check
    SwishError() (see below) for the type of error.

    If SwishError() returns false (zero) then it simply means that this
    result does not have any data for the specified property.

    If SwishError() returns true (non-zero) then either the propertyname
    specified is invalid, or the property requested is not a numeric (or
    date) property (e.g. it's a string property).

    See below on how to fetch the specific error message when SwishError()
    us true. 

> > 
> > Is there an easy way to get a list of all of the Properties?

There will be.  I have a patch in my inbox that does that.

> > The C Library is pretty usable, but here are some documentation
> > comments:
> > 
> > 1) examples would be nice in each function

I decided to leave the examples in libtest.c.  Less chance for the API
to give a wrong or out of date example if it doesn't show any

> > 
> > 2) links could supplement the descriptions (like on
> > SwishSetStructure, it would be nice to go right to the appropriate
> > section in Swish-Run)

Good idea.  Those cross-pod links don't always work in the program I'm
using, but I can try.

> > 
> > 3) SwishSeekResult - what does the parameter position do?

Well, the docs say:

  Sets the current seek position in the list of results, with position
  zero being the first record

Is that not clear?

Bill Moseley
Received on Wed Apr 28 13:15:23 2004