Gossamer Forum
Home : Products : Links 2.0 : Customization :

limit search result pages

Quote Reply
limit search result pages
I managed to limit my search results to 7 per page, but how can I limit it to a maximum of 10 pages? In other words, how can I display 7 results per page, and only show the first 10 pages, or 70 results?

Quote Reply
Re: [allthingsfree] limit search result pages In reply to
In search.cgi, sub search() at about line 264, add:
last LINE if ($numhits == 70);

this should be the last line of code inside the LINE while() loop, as in:

flock (DB, 1) if ($db_use_flock);
LINE: while (<DB>) {
/^#/ and next LINE; # Skip comment Lines.
#stuff here
last LINE if ($numhits == 70); #stop searching at max hits
close DB;

Note that a better way would be to get all the hits, sort them randomly, and take a slice of the results. That way all records have an equal chance of being displayed.

Limecat is not pleased.