root/tags/rel0_62/examples/reindex.pl

Revision 1162, 0.6 kB (checked in by dom, 8 months ago)

Install signal handlers in reindex.pl and CGI scripts to allow
temporary files (eg from Plucene) to be cleaned up. (fixes #247)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use sigtrap die => 'normal-signals';                                           
6
7use OpenGuides::Config;
8use OpenGuides::Utils;
9
10# This is a simple script to reindex every node in the wiki, useful if
11# your indexes got screwed up or you're swapping to a different searcher.
12
13my $config = OpenGuides::Config->new( file => "wiki.conf" );
14my $wiki = OpenGuides::Utils->make_wiki_object( config => $config );
15
16my @nodes = $wiki->list_all_nodes;
17foreach my $node ( sort @nodes ) {
18    my $content = $wiki->retrieve_node( $node );
19    $wiki->search_obj->index_node( $node, $content );
20    print "Reindexed $node\n";
21}
Note: See TracBrowser for help on using the browser.