function IndexStub($pages) { parent::Fulltext_Index('ASCII'); foreach ($pages as $page => $lexemes) { foreach ($lexemes as $lexeme) { if (!isset($this->lexemes[$lexeme])) { $this->lexemes[$lexeme] = array(); } $this->lexemes[$lexeme][] = $page; } } }
function search($query) { $entries = parent::search($query); // TODO: optimize this using temporary tables $pages = array(); foreach ($entries as $page_no => $score) { $result = mysql_query("SELECT title, path " . "FROM page " . "WHERE book_id = {$this->book_id} " . "AND no = {$page_no}") or die(__FILE__ . ':' . __LINE__ . ':' . mysql_error() . "\n"); $pages[] = mysql_fetch_row($result); } return $pages; }