Skip to main content.
home | support | download

Back to List Archive

Re: internal number question

From: Bill Moseley <moseley(at)>
Date: Mon Aug 30 2004 - 12:30:51 GMT
On Sun, Aug 29, 2004 at 10:33:38PM -0700, Jason Camp wrote:
> I'm writing an application around swish-e and I have a bunch of data stored in a
> database that I'd like to reference on search requests.

You mean search results, right?

> I read that swish-e uses an internal numbered index for each search
> result

Yes, there's two numbers -- a sequence number for search results
and there's a file number assigned to each file during indexing.

> is there any way to access that number?

As Peter said, swishfilenum is the property name for the internally
assigned file number, and swishreccount is the result counter:

moseley@bumby:~/apache$ swish-e -w server -x '<swishreccount> <swishfilenum> %t\n' -m 5 -H0 -s swishrank desc
1 48 Apache Core Features
2 97 Apache API notes
3 71 Apache module mod_proxy
4 100 International Customized Server Error Messages
5 128 VirtualHost Examples

moseley@bumby:~/apache$ swish-e -w server -x '<swishreccount> <swishfilenum> %t\n' -m 5 -H0 -s swishrank asc 
1 25 header.html
2 104 footer.html
3 122 footer.html
4 57 header.html
5 123 header.html

> I figure it would be the easiest way to associate the
> search results with the information in the database, I could base it off of the
> URL but the db operations would be much faster if it was numeric. Anyone have
> any thoughts?

I think swishfilenum is not that much help because you can't really relate
it to your database.  How about adding a primary key as a property
while indexing.  Then you can get that number back from search results
and then access your database.

Or, if you don't have too much data, just store the stuff you might
want to display in the swish index as properties and avoid hitting the
database on search results.

> I looked through the properties list and I didn't see anything
> that looked to be the internal number. I'm using the SWISH::API perl module if
> that helps. Thanks!

Yes, it's not very clear.  Just the SWISH::API "Synopisis" section
shows those:

    while ( my $result = $results->NextResult ) {
        printf("Path: %s\n  Rank: %lu\n  Size: %lu\n  Title: %s\n  Index: %s\n  Modified: %s\n  Record #: %lu\n  File   #: %lu\n\n",
            $result->Property( "swishdocpath" ),
            $result->Property( "swishrank" ),
            $result->Property( "swishdocsize" ),
            $result->Property( "swishtitle" ),
            $result->Property( "swishdbfile" ),
            $result->ResultPropertyStr( "swishlastmodified" ),
            $result->Property( "swishreccount" ),
            $result->Property( "swishfilenum" )

Bill Moseley

Unsubscribe from or help with the swish-e list:

Help with Swish-e:
Received on Mon Aug 30 05:31:08 2004