Date: Sunday February 2, 2003 @ 18:00
Author: matt
Update of /home/cvs/AxKit-XSP-Wiki/lib/AxKit/XSP
In directory ted.sergeant.org:/tmp/cvs-serv26511/lib/AxKit/XSP
Modified Files:
Wiki.pm
Log Message:
Added indexing (search still to come)
Log:
Submitted by:
Reviewed by:
PR:
Index: Wiki.pm
===================================================================
RCS file: /home/cvs/AxKit-XSP-Wiki/lib/AxKit/XSP/Wiki.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -b -u -r1.10 -r1.11
--- Wiki.pm 2003/01/29 14:20:39 1.10
+++ Wiki.pm 2003/02/02 18:00:34 1.11
@@ -254,6 +254,32 @@
EOT
$sth->execute($page, $texttype, $contents, $last_modified, $ip);
$db->commit;
+ _index_page($db, $page);
+}
+
+sub _index_page {
+ my ($db, $page) = @_;
+ my $sth = $db->prepare(<<'EOT');
+ SELECT Page.id, Page.content, Formatter.module
+ FROM Page, Formatter
+ WHERE Page.formatterid = Formatter.id
+ AND Page.name = ?
+EOT
+ $sth->execute($page);
+
+ my $output = '';
+ while ( my $row = $sth->fetch ) {
+ my $handler = AxKit::XSP::Wiki::Indexer->new(DB => $db, PageId => $row->[0]);
+ # create the parser
+ my $parser = $row->[2]->new(Handler => $handler);
+ eval {
+ $parser->parse_string($row->[1]);
+ };
+ if ($@) {
+ warn("Indexing failed");
+ }
+ last;
+ }
}
sub _mkrssheader {
@@ -367,6 +393,9 @@
)
});
$db->do(q{
+ create unique index Page_name on Page ( name )
+ });
+ $db->do(q{
create table History (
id INTEGER PRIMARY KEY,
name NOT NULL,
@@ -377,7 +406,31 @@
)
});
$db->do(q{
- create unique index Page_name on Page ( name )
+ CREATE TABLE IgnoreWord
+ (
+ id INTEGER PRIMARY KEY,
+ word NOT NULL
+ )
+ });
+ $db->do(q{CREATE UNIQUE INDEX IgnoreWord_word on IgnoreWord (word)});
+ $db->do(q{
+ CREATE TABLE Word
+ (
+ id INTEGER PRIMARY KEY,
+ word NOT NULL
+ )
+ });
+ $db->do(q{CREATE UNIQUE INDEX Word_word on Word (word)});
+ $db->do(q{
+ CREATE TABLE ContentIndex
+ (
+ page_id INTEGER NOT NULL,
+ word_id INTEGER NOT NULL,
+ value INTEGER NOT NULL
+ )
+ });
+ $db->do(q{
+ create unique index ContentIndex_idx on ContentIndex (page_id, word_id)
});
$db->do(q{
create table Formatter ( id INTEGER PRIMARY KEY, module NOT NULL, name NOT
NULL)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]