Esempio n. 1
0
def manage_addTextIndexNG(self, id, extra, REQUEST=None, RESPONSE=None, URL3=None):
    """Add a new TextIndexNG """

    from Registry import StopwordsRegistry

    # the ZMI passes the name of a registered Stopwords object (usually the
    # language abreviation like 'en', 'de'. 

    if extra.use_stopwords:
        sw = StopwordsRegistry.get(extra.use_stopwords)
        extra.use_stopwords = sw

    return self.manage_addIndex(id, 'TextIndexNG2', extra, REQUEST, RESPONSE, URL3)
Esempio n. 2
0
# check for converter modules

import os
from Products.TextIndexNG2.Registry import StopwordsRegistry
from Products.TextIndexNG2.Stopwords import FileStopwords
from Products.TextIndexNG2 import fast_startup

if not fast_startup:

    files = os.listdir(__path__[0])
    files = [x for x in files if x.endswith(".txt")]

    for fname in files:
        sw = FileStopwords(fname)
        StopwordsRegistry.register(sw.getLanguage(), sw)

    del files