Skip to main content.
home | support | download

Back to List Archive

Re: 2.4, SWISH API and maxhits

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Fri Sep 03 2004 - 02:34:09 GMT
On Thu, Sep 02, 2004 at 06:05:29PM -0700, Del Kimbler wrote:
> No, Hits below I understand to be all hits resulting from the search.  The 
> -m parameter on the command line is the maximum number of hits to 
> return.  If one could set maxhits (-m), that would be an upper bound for 
> Hits.  I am trying to find a way, using cgi and SWISH::API, to limit the 
> number of hits as I did in earlier versions.  I believe I could in this 
> version as well, if I used the forking version of a perl script, but that 
> has problems of its own.

Maybe you are missing this concept:

-m limits how many results are printed.  Not how many results are
found.

The command

    swish-e -w foo -m 2

still finds all 23,211 results for -w foo, but only prints the first
two.  If you want to start at some offset you use -b:

   swish-e -w foo -m 2 -b 1000

which prints two results starting at 1000.

With Swish::API you use $results->SeekResult() for -b and then for -m
you just only call $results->NextResult the number of times you want.

The above would be:

   $results->SwishSeek( 1000 - 1 );
   for ( 1..2 ) {
     my $result = $results->NextResult;
     [...]
   }

That help?

-- 
Bill Moseley
moseley@hank.org

Unsubscribe from or help with the swish-e list: 
   http://swish-e.org/Discussion/

Help with Swish-e:
   http://swish-e.org/current/docs
   swish-e@sunsite.berkeley.edu
Received on Thu Sep 2 19:34:24 2004