>> Is there an option that I am over looking that would
>> allow me to have search results from search.cgi saved
>> to a csv or text file for downloading/saving?
>
> I know of no feature in search.cgi or swish.cgi like that.
It's not that hard to do, of course.
Here's an example site that allows optional downloading of the results
of a swish.cgi-a-like in either CSV or PDF:
http://airforcehistoryindex.org/
The meat of the PHP script looks like this:
$results = $sw->execute($term . $xtra);
[ ... ]
deliverResults($results);
[ ... ]
function deliverCSV($results) {
global $csvCols;
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: attachment; filename=afhi-"
. gmdate("Y-m-d-H-i-s") . ".csv");
$out = fopen('php://output', 'w');
fputcsv($out, $csvCols);
$row = 0;
while ($r = $results->nextResult()) {
csvOutputRow($out, $r);
$row++;
if ($row > 65000)
break;
}
fclose($out);
exit(0);
}
And csvOutputRow() looks like this:
function csvOutputRow(&$out, &$r) {
$line = array(@$r->irisnum, @$r->abstract, @$r->accnotes,
@$r->accs_date, @$r->accsnrid, @$r->admin,
@$r->audiorec, @$r->author, @$r->beg_date, @$r->call,
@$r->circa, @$r->circa_pub, @$r->class, @$r->dnotes,
@$r->end_date, @$r->frame, @$r->framelst, @$r->fr_doc_id,
@$r->fr_rware_lib, @$r->index_date, @$r->indexid, @$r->irisref,
@$r->last_upd_date, @$r->lnft, @$r->main, @$r->majcom,
@$r->mflm_date, @$r->numpages, @$r->oldacc, @$r->pub_date,
@$r->qc_comments, @$r->qc_date, @$r->qcid, @$r->rcvd_date,
@$r->rectype, @$r->reel, @$r->rel_date, @$r->scanned_images,
@$r->scanrid, @$r->scnd_date, @$r->secinfo, @$r->subject,
@$r->title, @$r->title_ae, @$r->title_xt);
fputcsv($out, $line);
}
/jordan
_______________________________________________
Users mailing list
Users@lists.swish-e.org
http://lists.swish-e.org/listinfo/users
Received on Thu May 13 21:44:12 2010