Skip to main content.
home | support | download

Back to List Archive

Re: Grouping results

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Tue Nov 25 2003 - 21:28:53 GMT
On Tue, Nov 25, 2003 at 01:24:41PM -0800, Bill Moseley wrote:
> On Sun, Nov 23, 2003 at 12:45:23PM -0800, John Angel wrote:
> > Is it possible to group results by site like on Google (to display only 2 
> > hits from the same site, not all of them)?
> 
> Did I already respond to this?
> 
> You would have to post-process;  Need to think about what to do if
> showing a page of results at a time -- you might come up short.
> 
> Fake code:
> 
> my %seen;
> while ( my $result = next_result() ) {
>     my $uri = URI->new( $result->swishdocpath );
>     next if $seen{ $uri->host }++ == 2;

I assume you want something more like >= 2.


>     show_result( $result );
> }
> 
> -- 
> Bill Moseley
> moseley@hank.org
> 
> 

-- 
Bill Moseley
moseley@hank.org
Received on Tue Nov 25 21:29:39 2003