view MoinMoin/script/index/ @ 921:45e286183872

abstraction work on search engine index & cleanups
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Wed, 28 Jun 2006 23:41:46 +0200
parents 413cc62c6ec4
children da5623bc6819 72aeb2ba133d
line wrap: on
line source

# -*- coding: iso-8859-1 -*-
    MoinMoin - build xapian search engine's index

    You must run this script as owner of the wiki files, usually this is the
    web server user.

    @copyright: 2006 by MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.

from MoinMoin.script import MoinScript

class IndexScript(MoinScript):
    """ Xapian general index script class """

    def __init__(self, argv, def_values):
        MoinScript.__init__(self, argv, def_values)
            "--files", metavar="FILES", dest="file_list",
            help="filename of file list, e.g. files.lst (one file per line)"
            "--mode", metavar="MODE", dest="mode",
            help="either add (unconditionally add to index) or update (update an existing index)"
    def mainloop(self):
        # Do we have additional files to index?
        if self.options.file_list:
            self.files = file(self.options.file_list)
            self.files = None

class PluginScript(IndexScript):
    """ Xapian index build script class """

    def command(self):
        from import Index
        Index(self.request).indexPages(self.files, self.options.mode)