Skip to main content.
home | support | download

Back to List Archive

Re: switch to return just number of hits?

From: <moseley(at)>
Date: Fri Sep 12 2003 - 04:56:20 GMT
On Thu, Sep 11, 2003 at 05:46:11PM -0700, todd breslow wrote:

> is there a switch to just return the header and not the results? i am 
> integrating swish with a generic pager class and would like to display 
> the number of hits and then fetch page X of results. the only way i 
> have found to get the number of hits is to actually have all the 
> results returned. what am i missing?

Well, you would think you could say -m0, but that causes swish-e to 
display all.  So it might be possible to make -m0 truly report zero 

But this is what I'd do:

$ swish-e -w linux -m1 | grep '^# Number of hits'  
# Number of hits: 301

although I wouldn't use grep but rather just look for that output in a 

If you want more control than that check out the SWISH::API Perl module 
(or the C interface if not using Perl).

Bill Moseley
Received on Fri Sep 12 04:56:32 2003