FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Indexing/Searching FUDForum with Swish-e
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Indexing/Searching FUDForum with Swish-e [message #22370] Sun, 30 January 2005 16:57
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Protecting Email Addresses
Next Topic: Alternate Login...
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Dec 01 09:56:39 GMT 2024

Total time taken to generate the page: 0.02559 seconds