Home »
FUDforum »
How To »
Indexing/Searching FUDForum with Swish-e
Indexing/Searching FUDForum with Swish-e [message #22370] |
Sun, 30 January 2005 16:57 |
|
naudefj
Messages: 3771 Registered: December 2004
Karma:
|
Senior Member Administrator Core Developer |
|
|
Hi,
Here is a program I've written to index FUDForum with Swish-E (http://www.swish-e.org/).
This program might be handy to those that require an integrated site and forum search facility, or those that want term and phrase highlighting.
#!/usr/bin/php -q
<?php
// -----------------------------------------------------------------------------------
// Print out all FUDforum threads for indexing with Swish-e
//
// Usage: ./swish-e -S prog -i ./swishe_dump.php
// Author: Frank Naude - 30 Jan 2005
// -----------------------------------------------------------------------------------
set_time_limit(-1);
ini_set('memory_limit', '128M');
include("./GLOBALS.php");
include("./fuddata/scripts/fudapi.inc.php");
$c1 = q("SELECT * FROM ${DBHOST_TBL_PREFIX}thread");
while ($r1 = db_rowobj($c1)) {
$c2 = q("SELECT * FROM ${DBHOST_TBL_PREFIX}msg WHERE thread_id = " . $r1->id);
while ($r2 = db_rowobj($c2)) {
$fp = fopen($GLOBALS['MSG_STORE_DIR'].'msg_'.$r2->file_id, 'rb');
fseek($fp, $r2->foff);
$body = fread($fp, $r2->length);
$thread_body = $thread_body . '\n' . $body;
if ( !isset($subject) ) { $subject = $r2->subject; }
}
$thread_body = "<html><head><title>" . $subject . "</title></head><body>" .
$thread_body . "</body></html>\n\n";
echo "Path-Name: /forum/t/" . $r1->id . "/2/\n";
echo "Content-Length: " . strlen($thread_body) . "\n";
echo "Last-Mtime: " . $r1-> last_post_date . "\n\n";
echo $thread_body;
$thread_body = '';
unset($subject);
sleep(0);
}
?>
Best regards.
Frank
|
|
|
Goto Forum:
Current Time: Mon Nov 25 23:25:56 GMT 2024
Total time taken to generate the page: 0.05148 seconds