Skip to main content.
home | support | download

Back to List Archive

Re: FW: Trouble with Swish-e C API

From: Windmueller, David <DWindmueller(at)not-real.bloomberg.com>
Date: Wed Apr 28 2004 - 21:34:31 GMT
Thanks Bill for the quick fix.

I went through my browser history and found I somehow was looking at an older manual (2.2).  Not sure how I got there.

-David


-----Original Message-----
From: swish-e@sunsite.berkeley.edu
[mailto:swish-e@sunsite.berkeley.edu]On Behalf Of Bill Moseley
Sent: Wednesday, April 28, 2004 4:15 PM
To: Multiple recipients of list
Subject: [SWISH-E] Re: FW: Trouble with Swish-e C API


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?  http://swish-e.org/current/docs/SWISH-LIBRARY.html 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
examples...


> > 
> > 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
moseley@hank.org
Received on Wed Apr 28 14:34:32 2004