On Thu, Jun 22, 2000 at 05:32:51PM -0700, J C Lawrence wrote:
> On Thu, 22 Jun 2000 21:38:34 +0200 
> Willem Brown <[EMAIL PROTECTED]> wrote:
> 
> > Hi, I expire those pages manualy before starting the indexer. The
> > command is like this.
> 
> > indexer -a -u %/~lists/%/index.html \
> >   -u %/~lists/%/mail%.html          \
> >   -u %/~lists/%/thr%.html
I wrote a perl script to do just this in the database.  Glad to know there's
an easier way.
> 
> Ahh, this is neat.  The problem then is getting the pages in your DB
> with well staggered expire times so a limited number of pages expire
> each day, rather than everything expiring all at once.

Once I indexed my entire site, I ran a script which randomizes the expiry
times.  This way, when I run the indexer every day, a subset gets indexed.

--- cut ---
#!/usr/bin/perl
use DBI;
$starttime = time();
$endtime = $starttime + 2592000; # 1 month
$dbh = DBI->connect("DBI:mysql:udmsearch:localhost", "www", "xxxx") ||
die "connect: $!\n";
$sth = $dbh->prepare("select rec_id from url");
$sth->execute || die "execute: $!\n";
while(@row = $sth->fetchrow)
{
$t = int(rand($endtime - $starttime) + $starttime);
#print "$row[0] \n";
$dbh->do("update url set next_index_time = $t where rec_id = $row[0]") ||
die "update: $!\n";
}
$dbh->disconnect;
--- cut ---


-- 
Shane Wegner: [EMAIL PROTECTED]
Personal website: http://www.cm.nu/~shane/

PGP signature

Reply via email to